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: Correctly display expired sidebar card and subscription expiration modal #1074

Merged
merged 12 commits into from
May 13, 2024

Conversation

brobro10000
Copy link
Contributor

@brobro10000 brobro10000 commented May 7, 2024

Updates the API call to the learner-licenses endpoint include the query parameter current_plans_only=false to properly display an expired subscription license.
Also reintroduces the use of hasValidStartExpirationDates when determining is a subscription isCurrent. This reintroduction handle zero date validation where the day of expiration is also accounted for when daysUntilExpiration or daysUntilExpirationIncludingRenewals is zero but is within a 24 hour period before expiration.

Following up with Joe, language updatedx for expired and expiring courses to the following.
Screenshot 2024-05-09 at 11 49 04 AM
Screenshot 2024-05-09 at 11 54 58 AM

Expired:
Screenshot 2024-05-07 at 10 38 04 AM

We also update the expiry modal to adequately handle singular and plural days/hours/minutes when the current subscription is expiring.

Day and Days:
Screenshot 2024-05-07 at 10 31 41 AM
Screenshot 2024-05-07 at 10 32 31 AM

Hours and Hour:
Screenshot 2024-05-07 at 10 33 35 AM
Screenshot 2024-05-07 at 10 37 24 AM

Minutes and Minute:
Screenshot 2024-05-07 at 10 39 19 AM
Screenshot 2024-05-07 at 10 36 49 AM
984c-15dc0c92fe64)

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

@brobro10000 brobro10000 marked this pull request as ready for review May 7, 2024 15:38
Copy link

codecov bot commented May 7, 2024

Codecov Report

Attention: Patch coverage is 98.52941% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 84.70%. Comparing base (f5b08c3) to head (ff27ffa).
Report is 2 commits behind head on master.

❗ Current head ff27ffa differs from pull request most recent head ba945ee. Consider uploading reports for the commit ba945ee to get more accurate results

Files Patch % Lines
src/components/dashboard/sidebar/utils.js 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1074      +/-   ##
==========================================
- Coverage   84.79%   84.70%   -0.09%     
==========================================
  Files         393      393              
  Lines        8076     8109      +33     
  Branches     1934     1948      +14     
==========================================
+ Hits         6848     6869      +21     
- Misses       1171     1180       +9     
- Partials       57       60       +3     

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

Copy link
Member

@adamstankiewicz adamstankiewicz left a comment

Choose a reason for hiding this comment

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

LGTM, with a few tiny nits.

Comment on lines 14 to 17
const hasUnexpiredPolicies = unexpiredPolicies.length > 0;
if (hasUnexpiredPolicies) {
return unexpiredPolicies.sort((a, b) => new Date(a.subsidyExpirationDate) - new Date(b.subsidyExpirationDate))[0];
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If there exists some unexpired policies, we return the soonest expiring policy metadata.

if (hasUnexpiredPolicies) {
return unexpiredPolicies.sort((a, b) => new Date(a.subsidyExpirationDate) - new Date(b.subsidyExpirationDate))[0];
}
return expiredPolicies.sort((a, b) => new Date(b.subsidyExpirationDate) - new Date(a.subsidyExpirationDate))[0];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Otherwise we display the last expired budget.

src/components/dashboard/SubscriptionExpirationModal.jsx Outdated Show resolved Hide resolved
src/components/dashboard/SubscriptionExpirationModal.jsx Outdated Show resolved Hide resolved
src/components/dashboard/SubscriptionExpirationModal.jsx Outdated Show resolved Hide resolved
src/components/dashboard/data/utils.js Outdated Show resolved Hide resolved
src/components/dashboard/sidebar/utils.js Outdated Show resolved Hide resolved
@brobro10000 brobro10000 merged commit 1efd730 into master May 13, 2024
5 checks passed
@brobro10000 brobro10000 deleted the hu/ent-8609 branch May 13, 2024 16:36
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