Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 allocated runs on the course about page #1142
feat: display allocated runs on the course about page #1142
Changes from 8 commits
780da7e
a44878c
621c86d
131efa3
7b692e9
45a66f4
d58dfeb
6c4c544
2313a27
c92365b
4f3397f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Spent some time making this a hook that sourced its own
courseKey
andredeemableLearnerCreditPolicies
but ran into an issue attempting to use this in thecouresLoader
. B/c thecourseLoader
is not a functional react component, I could not utilize this function as a hook. The tradeoff of using a hook vs a function was not including the performance enhancements of thecan-redeem
call, so I opted to retain the performance enhancements ofcan-redeem
and keep it as a function.One improvement is the return of the
allocatedCourseRunAssignments
value which returns the metadata of the course run based allocations versus just the course keys.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.
[question/clarification] Why might we only want to mutate the below
courseRuns
andavailableCourseRuns
values whenhasMultipleAssignedCourseRuns: true
? Is there a particular reason we wouldn't want to go that if the user has a single allocated assignment applicable to the current course?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.
When a user has a single allocated assignment, we alter how we retrieve course metadata.
For a single allocation with no
course_run_key
defined, we are defaulting thecourseRunKey
to the allocated course run key, only returning a single course from course metadata. That way we don't have to go through the additional step of filtering by the allocated course run a second time.For a single allocation with a course_run_key, we are returning a single course regardless, so any UI changes (such as important dates) would have to be parsed down stream to determine if the singular course run displayed (via
course_run_key
) is an allocated course run.For
hasMultipleAssignedCourseRuns: true
state, we are opting to use thecourseKey
to return all course runs from course metadata. Then we transform it further with this function. This approach allows us to treat the multiple course runs for a single course as a true edge case (that could easily be ripped out) as opposed to baking it into the default logic.