-
Notifications
You must be signed in to change notification settings - Fork 3
add one click enroll functionality to dashboard cards #2319
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
Conversation
49d04f3
to
564bde9
Compare
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.
Looks good and thanks @gumaerc for helping me get set up to fuel this locally.
Some observations:
- In the
mitxonlineEnrollment()
transform we get the status from the grades https://github.com/mitodl/mit-learn/pull/2319/files#diff-e27375eac7f9200d6414e93f9318b1314ba646ed3045910b06f7cc6896ae9dd8R45-R47
status: raw.grades[0]?.passed
? EnrollmentStatus.Completed
: EnrollmentStatus.Enrolled,
The status is therefore never EnrollmentStatus.NotEnrolled
as the new logic sometimes expects.
- If I set the course run enrollment to anything other than
enrolled
in the mitxonline admin e.g. http://mitxonline.odl.local:8013/admin/courses/courserunenrollment/1/change/, I do not see any change from the enrollments endpoint (http://mitxonline.odl.local:8065/api/v1/enrollments/) to determine the status.
const hasStarted = startDate && isInPast(startDate) | ||
const notEnrolled = |
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.
Small request for
const hasEnrolled = enrollmentStatus &&
enrollmentStatus !== EnrollmentStatus.NotEnrolled
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 are indeed correct that enrollment.status
is currently never explicitly set to EnrollmentStatus.NotEnrolled
. The check for the status at all is there because unenrolled courses come from mitxonlineUnenrolledCourse()
(also in transform.ts
) and do not get enrollment
set on them at all, hence the check for it being not set. Overall I think the logic makes more sense this way though, so I changed it.
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.
Got it - DashboardCard is also used in OrganizationContent.tsx and fed by the queries there 👍
564bde9
to
0df64c3
Compare
@jonkafton Thanks for your review, this is ready for another look. I also updated the default for the MITx Online CSRF token name, as it was changed in MITx Online in mitodl/mitxonline#2762 |
What are the relevant tickets?
Closes https://github.com/mitodl/hq/issues/7651
Description (What does it do?)
This PR adds the ability to utilize the "one click enroll" B2B API in MITx Online. Cards for courses in
OrganizationContent
that are part of your org but you are not yet enrolled in will have a button that says "Enroll" instead of "Continue Course." Clicking this button enrolls you in the course, after which you can click "Continue Course" as normal.How can this be tested?
In order to test this, you need a basic installation of
mitxonline
up and running with example data in it. You may be able to skip one or more steps if you have already done them:hosts
redirects for the following domains, replacing the example IP with your local IP address (Google how to get this if unsure, mine is 192.168.1.50)mitxonline
: https://github.com/mitodl/mitxonline.env
file with the following values:mitxonline
withdocker compose up --build -d
docker compose exec web ./manage.py promote_user --promote --superuser admin@odl.local
docker compose exec web ./manage.py populate_course_data
pants docs ::
dist/sphinx/index.html
, read the section on generating a B2B organization / contract and create one, adding some of the test courses to itProgram
and add some courses to the program that are included in your B2B org, making sure to mark the program as "live"mit-learn
, we need to set some env variables (note that we are intentionally misconfiguring the cookie domain):enrollment-dashboard
andmitlearn-organization-dashboard
feature flags for all usersMIT Learn
admin@odl.local
test user