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

When resolving the current run, make sure it's also enrollable #2046

Merged
merged 6 commits into from
Jan 4, 2024

Conversation

jkachel
Copy link
Contributor

@jkachel jkachel commented Jan 4, 2024

What are the relevant tickets?

mitodl/hq#3295

Description (What does it do?)

If the app has to resolve which course run it should be working with, sometimes it will fail back to just the first one in the list that comes back from the API. This can result in a course run that's not enrollable being chosen. This PR adds a check to favor the first enrollable course run over just the first one in the list, and then fall back to the first one in the list if there's not one that's eligible.

How can this be tested?

I tested by copying the courserun info for course-v1:MITxT+14.100x+3T2023 and 1T2024 from production, making sure both had products, and then forcing an audit enrollment in 3T2023. Once done, you should be able to load the course page for 14.100x, and clicking Enroll Now should offer to upgrade you to 1T2024. Clicking upgrade or hitting Enroll for Free should enroll you in the correct (1T2024) run.

@pdpinch
Copy link
Member

pdpinch commented Jan 4, 2024

I thought we had a design for when there is no enrollable run. @mbilalmughal do you know?

@jkachel
Copy link
Contributor Author

jkachel commented Jan 4, 2024

If there's really nothing for you to enroll in, you just don't get a button at all.

Copy link
Contributor

@JenniWhitman JenniWhitman left a comment

Choose a reason for hiding this comment

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

After setting up a similar test, I was enrolled in the more current course run despite my old enrollment.

Copy link
Contributor

@collinpreston collinpreston left a comment

Choose a reason for hiding this comment

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

I think getFirstUnenrolledCourseRun can be removed from frontend/public/src/components/CourseProductDetailEnroll.js since it's not used anywhere.

@jkachel jkachel merged commit efaf487 into main Jan 4, 2024
3 checks passed
@odlbot odlbot mentioned this pull request Jan 4, 2024
1 task
@jkachel
Copy link
Contributor Author

jkachel commented Jan 4, 2024

saw @collinpreston 's note as I was merging.. I agree with that but in the interest of getting this out sooner I went ahead and merged. I'll throw a separate PR up with that change later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants