Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent NotFoundPage on successful redemption while still on ExternalCourseEnrollment #1197

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

adamstankiewicz
Copy link
Member

@adamstankiewicz adamstankiewicz commented Sep 20, 2024

https://2u-internal.atlassian.net/browse/ENT-9423

For all changes

  • Ensure adequate tests are in place (or reviewed existing tests cover changes)
  • Ensure English strings are marked for translation. See documentation for more details.

Only if submitting a visual change

  • Ensure to attach screenshots
  • Ensure to have UX team confirm screenshots

@@ -77,7 +77,7 @@ const ExternalCourseEnrollment = () => {
// current date is outside the enrollment window of the run.
if (userSubsidyApplicableToCourse.subsidyType === LEARNER_CREDIT_SUBSIDY_TYPE) {
const canRedeemDataCourseRun = redeemabilityPerContentKey.find(r => r.contentKey === courseRunKey);
if (!canRedeemDataCourseRun?.canRedeem) {
if (!canRedeemDataCourseRun?.canRedeem && !canRedeemDataCourseRun?.hasSuccessfulRedemption) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upon successful redemption of an Exec Ed course, the API calls to can-redeem, credits_available, and enterprise_course_enrollments are invalidated/re-fetched in parallel.

When the can-redeem API resolves first, it's response will update to have canRedeem: false and hasSuccessfulRedemption: true; however, this code path would handle this case as showing the <NotFoundPage /> component, which isn't correct.

Once the other API calls resolve, the user is navigated to the complete route for the enrollment confirmation screen as intended.

This fix ensures we don't show the <NotFoundPage /> while resolving the other API calls.

Copy link

codecov bot commented Sep 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.42%. Comparing base (f35543e) to head (5d763f3).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1197   +/-   ##
=======================================
  Coverage   88.42%   88.42%           
=======================================
  Files         396      396           
  Lines        8407     8407           
  Branches     2061     2022   -39     
=======================================
  Hits         7434     7434           
- Misses        930      931    +1     
+ Partials       43       42    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@adamstankiewicz adamstankiewicz changed the title fix: handle successful redemption on ExternalCourseEnrollment fix: prevent NotFoundPage on successful redemption while still on ExternalCourseEnrollment Sep 20, 2024
@adamstankiewicz adamstankiewicz changed the title fix: prevent NotFoundPage on successful redemption while still on ExternalCourseEnrollment fix: prevent NotFoundPage on successful redemption while still on ExternalCourseEnrollment Sep 20, 2024
@adamstankiewicz adamstankiewicz merged commit f7bcbfe into master Sep 20, 2024
6 checks passed
@adamstankiewicz adamstankiewicz deleted the ags/ent-9423 branch September 20, 2024 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants