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

feat: display warning when plan is about to expire #1177

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

zwidekalanga
Copy link
Contributor

@zwidekalanga zwidekalanga commented Feb 27, 2024

For all changes

  • Ensure adequate tests are in place (or reviewed existing tests cover changes)

Only if submitting a visual change

6a54ca9b-86fb-4d50-abc5-91f8fc1de163.mp4
  • Ensure to attach screenshots
  • Ensure to have UX team confirm screenshots

@zwidekalanga zwidekalanga changed the title Display warning when plan is about to expire feat: display warning when plan is about to expire Mar 13, 2024
@zwidekalanga zwidekalanga force-pushed the zwidekalanga/ent-7934 branch 2 times, most recently from db6d182 to 859753c Compare March 14, 2024 00:38
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.

Left some comments/suggestions (most notably around removing the need to do as much prop drilling, etc. to pass budgets related data into your BudgetExpiryComponent), and several clarifying questions about the removal of the no longer relevant "Contact representative" modal, and some duplicative functions serving the same purpose.

Note, it'd also be great to include screenshots in the PR description for UI-facing changes such as these to aid reviewers as well (per the PR checklist template).

src/components/Admin/index.jsx Outdated Show resolved Hide resolved
src/components/BudgetExpiryComponent/index.jsx Outdated Show resolved Hide resolved
src/components/BudgetExpiryComponent/index.jsx Outdated Show resolved Hide resolved
src/components/BudgetExpiryComponent/index.jsx Outdated Show resolved Hide resolved
src/components/learner-credit-management/data/utils.js Outdated Show resolved Hide resolved
src/eventTracking.js Outdated Show resolved Hide resolved
@zwidekalanga zwidekalanga force-pushed the zwidekalanga/ent-7934 branch 5 times, most recently from d7ca0cd to 5750f0d Compare March 25, 2024 13:26
@zwidekalanga zwidekalanga force-pushed the zwidekalanga/ent-7934 branch 2 times, most recently from 8bd8853 to f28856e Compare March 27, 2024 16:21
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.

Looks good to me! I just have one clarifying question about the changes in orderBudgets that I might recommend looking into before this merges.

src/components/learner-credit-management/data/utils.js Outdated Show resolved Hide resolved
src/components/Admin/__snapshots__/Admin.test.jsx.snap Outdated Show resolved Hide resolved
src/components/Admin/index.jsx Outdated Show resolved Hide resolved
Copy link
Contributor

@brobro10000 brobro10000 left a comment

Choose a reason for hiding this comment

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

Attempted to review but some unaddressed PR feedback remaining. Will check tomorrow morning for a quick lookover.

@zwidekalanga zwidekalanga force-pushed the zwidekalanga/ent-7934 branch 7 times, most recently from 733a6c5 to 8bc645f Compare April 4, 2024 07:23
Copy link

codecov bot commented Apr 4, 2024

Codecov Report

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

Project coverage is 85.54%. Comparing base (a19fe04) to head (8bc645f).
Report is 2 commits behind head on master.

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

Files Patch % Lines
src/components/BudgetExpiryAlertAndModal/index.jsx 84.00% 4 Missing ⚠️
...BudgetExpiryAlertAndModal/data/hooks/useExpiry.jsx 87.50% 3 Missing ⚠️
src/components/Admin/index.jsx 75.00% 1 Missing ⚠️
...anagement/BudgetDetailPageOverviewAvailability.jsx 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1177      +/-   ##
==========================================
+ Coverage   85.46%   85.54%   +0.07%     
==========================================
  Files         508      514       +6     
  Lines       11074    11169      +95     
  Branches     2329     2348      +19     
==========================================
+ Hits         9464     9554      +90     
- Misses       1566     1571       +5     
  Partials       44       44              

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

Copy link
Contributor

@brobro10000 brobro10000 left a comment

Choose a reason for hiding this comment

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

Approved with 1 nit that needs to be addressed.

@zwidekalanga zwidekalanga force-pushed the zwidekalanga/ent-7934 branch 3 times, most recently from e86e9cb to e972937 Compare April 10, 2024 09:31
Comment on lines +312 to +314
<div className="mt-4">
<BudgetExpiryAlertAndModal />
</div>
Copy link
Member

@adamstankiewicz adamstankiewicz Apr 11, 2024

Choose a reason for hiding this comment

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

nit: if no alert is rendered, it appears (per the Admin.test.jsx.snap snapshot file) this renders an empty div with mt-4. Is this adding extra whitespace to the Learner Progress Report when there is no budget expiry alert?

Perhaps the .mt-4 could be rendered within the div.col below where we render the <h2> heading, which already has a .mt-4 specified all the time.

const thresholdKeys = Object.keys(ExpiryThresholds).sort((a, b) => a - b);
const thresholdKey = thresholdKeys.find((key) => durationDiff.asDays() <= key);

if (thresholdKey === undefined) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: is the check against undefined necessary or could it be simplified to !thresholdKey?

export const isPlanApproachingExpiry = (endDateStr) => {
const { thresholdKey, threshold } = getExpirationMetadata(endDateStr);

if (thresholdKey === null) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: is the check against null necessary or could it be simplified to !thresholdKey?

@adamstankiewicz adamstankiewicz merged commit 220f4fa into openedx:master Apr 11, 2024
4 checks passed
zwidekalanga added a commit to zwidekalanga/frontend-app-admin-portal that referenced this pull request Apr 11, 2024
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.

3 participants