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: add date metadata for course run assignments on coures about page #1145

Merged
merged 11 commits into from
Aug 14, 2024

Conversation

brobro10000
Copy link
Member

@brobro10000 brobro10000 commented Aug 8, 2024

Adds course run related enrollBy date and courseStart date on the course about page for assignment based enrollments.

For instances where multiple course runs are assigned to a course, the soonest earliestExpirationDate date is displayed along with its corresponding course start date.

Properly handles tense for when a course started vs course starts.

Screenshot 2024-08-08 at 1 40 18 PM

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 force-pushed the hu/ent-8887 branch 2 times, most recently from b7da0d9 to c956e93 Compare August 9, 2024 14:33
Copy link

codecov bot commented Aug 12, 2024

Codecov Report

Attention: Patch coverage is 86.53846% with 7 lines in your changes missing coverage. Please review.

Project coverage is 88.05%. Comparing base (4f4566e) to head (5a900c2).
Report is 1 commits behind head on master.

Files Patch % Lines
src/components/course/data/utils.jsx 70.58% 5 Missing ⚠️
...ents/course/course-header/CourseImportantDates.jsx 94.11% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1145      +/-   ##
==========================================
- Coverage   88.06%   88.05%   -0.02%     
==========================================
  Files         393      394       +1     
  Lines        8289     8338      +49     
  Branches     2027     2047      +20     
==========================================
+ Hits         7300     7342      +42     
- Misses        947      953       +6     
- Partials       42       43       +1     

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

@brobro10000 brobro10000 marked this pull request as ready for review August 13, 2024 16:53
src/components/app/data/utils.js Outdated Show resolved Hide resolved
src/components/app/data/utils.js Outdated Show resolved Hide resolved
src/components/app/data/utils.js Outdated Show resolved Hide resolved
src/components/app/data/utils.js Outdated Show resolved Hide resolved
const today = new Date();
const startDate = new Date(start);
return startDate && today >= startDate;
return dayjs(start).isBefore(dayjs());
Copy link
Member

Choose a reason for hiding this comment

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

🎉

dateFormat = null,
}) {
if (!assignments?.length) {
logInfo(`[sortedByExpirationDate] ${assignments} an empty array`);
Copy link
Member

Choose a reason for hiding this comment

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

[nit/curious] Is the [sortedByExpirationDate] prefix intended to match the function name? E.g., at this point in the code path sortedByExpirationDate does not exist (i.e., defined below line 928).

Copy link
Member

Choose a reason for hiding this comment

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

nit: given assignments is an empty array, i'm not sure how much utility there is in including the variable itself in the logInfo?:

image

Would this message make sense as something like, [sortedByExpirationDate] no assignments provided in array or similar?

Semi-related (curious for your two cents!), I'm wondering if we might want to treat this and the below logInfo as logError given it seems in the code path where this function is called, it's only called when there are assigned course runs, we might want to consider it as an error that could trigger an alert for observability/monitoring. For example, if we determine there are assigned course runs, and then pass in empty array or the assignments are all missing .earliestPossibleExpiration, would we want to consider that an error? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

I had this debate with myself as well when implementing this approach. I guess I overlooked the part where we are deep enough into the code path to expect assignments in the array at this point so a change to logError would make the most sense. Changing now 👍🏽
Also, at one point the function name was sortedByExpirationDate but ended up changing the name and not the variable. Updated to take that into account.

src/components/course/data/utils.jsx Outdated Show resolved Hide resolved
src/components/course/data/utils.jsx Outdated Show resolved Hide resolved
@brobro10000 brobro10000 merged commit 8dafafc into master Aug 14, 2024
6 of 7 checks passed
@brobro10000 brobro10000 deleted the hu/ent-8887 branch August 14, 2024 18:49
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