-
Notifications
You must be signed in to change notification settings - Fork 32
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: assign by course run implementation #1292
Conversation
5473422
to
6411917
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1292 +/- ##
==========================================
+ Coverage 85.60% 85.64% +0.04%
==========================================
Files 566 567 +1
Lines 12467 12590 +123
Branches 2602 2634 +32
==========================================
+ Hits 10672 10783 +111
- Misses 1737 1748 +11
- Partials 58 59 +1 ☔ View full report in Codecov by Sentry. |
25667e8
to
e1e7ec9
Compare
const [emptyState] = useState(courseRuns.length === 0); | ||
return ( | ||
<Dropdown id={courseKey}> | ||
<Dropdown.Toggle variant="primary" id="assign-by-course-runs-dropdown"> |
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.
Given there are multiple "Assign" CTAs rendered in the search results, I believe this id
should be unique per search result?
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.
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.
What about id="assign-by-course-runs-dropdown"
, though? Is the id
on the top-level Dropdown
necessary? On the Paragon docs site, it looks like it's only passed on the Dropdown.Toggle
. Should the courseKey
be included as part of this id
to make it unique?
src/components/learner-credit-management/assignment-modal/NewAssignmentModalDropdown.jsx
Outdated
Show resolved
Hide resolved
src/components/learner-credit-management/assignment-modal/NewAssignmentModalDropdown.jsx
Outdated
Show resolved
Hide resolved
src/components/learner-credit-management/assignment-modal/NewAssignmentModalDropdown.jsx
Outdated
Show resolved
Hide resolved
return ( | ||
<section className="assignments-important-dates small"> | ||
{enrollByDate && ( | ||
<AssignmentModalImportantDate label={intl.formatMessage(messages.enrollByDate)}> |
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.
Nice abstraction of AssignmentModalImportantDate
:)
src/components/learner-credit-management/cards/CourseCardFooterActions.jsx
Show resolved
Hide resolved
src/components/learner-credit-management/cards/data/useCourseCardMetadata.jsx
Outdated
Show resolved
Hide resolved
src/components/learner-credit-management/assignment-modal/AssignmentModalmportantDates.jsx
Outdated
Show resolved
Hide resolved
src/components/learner-credit-management/assignment-modal/AssignmentModalmportantDates.jsx
Outdated
Show resolved
Hide resolved
201ce8b
to
7a8f7ca
Compare
src/components/learner-credit-management/BudgetDetailPageOverviewAvailability.jsx
Outdated
Show resolved
Hide resolved
src/components/learner-credit-management/assignment-modal/AssignmentModalmportantDates.jsx
Outdated
Show resolved
Hide resolved
src/components/learner-credit-management/assignment-modal/NewAssignmentModalButton.jsx
Outdated
Show resolved
Hide resolved
src/components/learner-credit-management/cards/CourseCardFooterActions.jsx
Outdated
Show resolved
Hide resolved
src/components/learner-credit-management/cards/data/useCourseCardMetadata.jsx
Outdated
Show resolved
Hide resolved
const footerText = intl.formatMessage(messages.courseFooterMessage, { | ||
courseRuns: assignableCourseRuns.length, | ||
pluralText: pluralText('date', assignableCourseRuns.length), | ||
}); |
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.
nice construction of the i18n message here!
@@ -22,6 +22,12 @@ export const API_FIELDS_BY_TABLE_COLUMN_ACCESSOR = { | |||
courseListPrice: 'course_list_price', | |||
}; | |||
|
|||
// Course pace text |
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.
Thank you for making sure we stick to a single constants
file within this module 🙌
return weeksToComplete <= differenceInWeeks; | ||
}; | ||
|
||
const isWithinMinimumStartDateThreshold = ({ start }) => dayjs(start).isBefore(dayjs().subtract(START_DATE_DEFAULT_TO_TODAY_THRESHOLD_DAYS, 'days')); |
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.
👨🍳 💋
* @param punctuation | ||
* @returns {string} | ||
*/ | ||
const pluralText = ( |
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.
[inform] I think what you have here is fine, but just as a heads up, it looks like there is some support for defining plural messages within the message format (ICU syntax, see https://formatjs.io/docs/core-concepts/icu-syntax/#plural-format) or perhaps FormattedPlural
(docs).
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.
Leaving comment open as reference 👍🏽
ec4be07
to
f75e9d1
Compare
// Maximum days allowed from enrollment for a refund on assignments related to policies | ||
export const MAX_ALLOWABLE_REFUND_THRESHOLD_DAYS = 14; | ||
|
||
// Start date threshold to default to today days, sets start date to today if course start date is beyond this value |
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.
Nit:
// Start date threshold to default to today days, sets start date to today if course start date is beyond this value | |
// When the start date is before this number of days before today, display the alternate start date (fixed to today). |
src/components/learner-credit-management/assignment-modal/AssignmentModalContent.jsx
Outdated
Show resolved
Hide resolved
src/components/learner-credit-management/assignment-modal/NewAssignmentModalButton.jsx
Outdated
Show resolved
Hide resolved
src/components/learner-credit-management/cards/data/useCourseCardMetadata.jsx
Show resolved
Hide resolved
src/components/learner-credit-management/cards/data/useCourseCardMetadata.jsx
Outdated
Show resolved
Hide resolved
becf1b4
to
783a5de
Compare
src/components/learner-credit-management/AssignmentDetailsTableCell.jsx
Outdated
Show resolved
Hide resolved
2cd1ccc
to
063cd1a
Compare
a3687dd
to
d1b71e3
Compare
d1b71e3
to
9a899a3
Compare
start: mockCurrentStartDate, | ||
end: dayjs(mockCurrentStartDate).add(1, 'year').toISOString(), | ||
enroll_by: dayjs(mockCurrentStartDate).unix(), |
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.
nit: curious whether we can either rename this mock date to be more generic or have separate variables to use for each related field.
As is, the mockCurrentStartDate
is being used for end
/enroll_by
dates, too which could be a bit misleading/confusing.
@@ -111,6 +111,9 @@ export const START_DATE_DEFAULT_TO_TODAY_THRESHOLD_DAYS = 14; | |||
// Default empty content_price value | |||
export const EMPTY_CONTENT_PRICE_VALUE = 0; | |||
|
|||
// |
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.
nit: empty comment
), | ||
); | ||
} | ||
if (hasCourseStarted(enrollBy) && isLateRedemptionAllowed) { |
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.
nit: Should we be using a function hasCourseStarted
with an enrollBy
date (seems somewhat misleading/confusing)? Perhaps this util function should be renamed to be more generic, so it's not tied explicitly to "start" dates based on its name.
9a899a3
to
027fee7
Compare
isEligibleForEnrollment = dayjs(enrollBy).isBefore( | ||
Math.min( | ||
dayjs(subsidyExpirationDatetime).subtract(MAX_ALLOWABLE_REFUND_THRESHOLD_DAYS, 'days').toDate(), | ||
dayjs().add(DAYS_UNTIL_ASSIGNMENT_ALLOCATION_EXPIRATION, 'days').toDate(), | ||
), | ||
); |
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.
You sure just changing this to min is sufficient? The docstring was updated to match this logic, but still the desired outcome is not explicitly stated. If the goal is as I described it previously, then I think this is still incorrect because it guarantees that learners ALWAYS have less than 90 days to accept an assignment.
d810af3
to
eba4828
Compare
bdf9629
to
938303b
Compare
* - If hasEnrollBy, we return assignments with enroll before the soonest of the two date: The subsidy expiration | ||
* date - refund threshold OR today offset by the 90-day allocation threshold for an assignment denoted as | ||
* isEligibleForEnrollment | ||
* - If hasEnrollBy, we return assignments with enroll before the soonest date: The subsidy expiration |
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.
nit: enroll
-> enrollBy
(deferred)
Ability to assign learner credit assignments by individual course runs. This is a hard cutover from assigning from the top level course key to the individual course run.
Displays an enroll-by date for each applicable course run that currently verifies that the enroll-by date of the course run is before the
subsidyExpirationDate
-MAX_ALLOWABLE_REFUND_THRESHOLD_DAYS
to ensure course runs that are far in the future beyond the policies term are not displayed but respect the ability to provide refunds within the subsidy expiration date.This PR also includes:
content_price
start_date
to todaycourse_runs
to accurately test the changes.Catalog search results card.
Allocation screen:
Zero state was also added for edge cases that the enroll-by date for all course runs is beyond the
subsidyExpirationDate
+STALE_ENROLLMENT_DROPOFF_DAYS
thresholdCatalog search zero state:
For all changes
Only if submitting a visual change