-
Notifications
You must be signed in to change notification settings - Fork 19
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: update redirect logic to take into account available coupon codes #906
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #906 +/- ##
==========================================
+ Coverage 84.87% 84.96% +0.09%
==========================================
Files 320 338 +18
Lines 6399 7091 +692
Branches 1552 1734 +182
==========================================
+ Hits 5431 6025 +594
- Misses 941 1035 +94
- Partials 27 31 +4 ☔ View full report in Codecov by Sentry. |
src/components/enterprise-user-subsidy/enterprise-offers/data/utils.js
Outdated
Show resolved
Hide resolved
804148d
to
b30f6a0
Compare
if (allocatedOrAcceptedAssignments?.length === 0) { | ||
return false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this check redundant considering the next line already checks allocatedOrAcceptedAssignments?.length > 0
? Perhaps the last line of this function can be simplified to just return activeOffers?.length > 0;
?
Updates my favorite function,
isDisableCourseSearch
, to take into account existing coupon codes before redirecting. If there exists an available coupon code, then we will not redirect away from the course about page.We also refactor the
isDisableCourseSearch
to return out of the function as false (can view the course page) in the following order.nonAssignablePolicyType
exist where anonAssignablePolicyType
is not 'AssignedLearnerCreditAccessPolicy'hasActiveSubPlan
where a subscription plan is active AND the subscription license status is 'activated'hasCouponCodes
where a coupon code is available (active defined as the current date/time falls between a coupon start/end date)allocatedOrAcceptedAssignment
where an assignment state is either 'accepted' OR 'allocated'A user is redirected away from the course about page if either of the following conditions are true
activeOffer
where an active offer is defined as a current offerallocatedOrAcceptedAssignment
where an assignment assignment state is either 'accepted' OR 'allocated'For all changes
Only if submitting a visual change