-
Notifications
You must be signed in to change notification settings - Fork 134
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
Prevent unwanted course enrollment changes #2064
base: dev
Are you sure you want to change the base?
Conversation
…level if the user was auto-enrolled in the course by a different membership.
51a125e
to
0b35d9c
Compare
@gocodebox/engineering, please forgive the large number of changes to Are there any test scenarios that you would like me to add? |
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.
This looks pretty good, and covers pretty well the unwanted unenrollments when removing a membership level, although there's something we're missing here:
config:
Membership M1 -> courses C1, C2
do:
S1 purchases C2's access plan-> enrolled in C2
enroll S1 into M1 -> auto-enrolled in C1 (already enrolled in C2)
cancel (not delete) the C2 order from the order screen -> unenrolled C2, this is to simulate e.g. an access plan expiration.
Although the student has still a valid access to C2 through M1.
We should prevent this, what do you think?
On the other hand a manual unenrollment of a student from a course performed by an admin should bypass this restriction.
This is getting complicated.
I wonder if we shouldn't take this as an occasion to think how to restructure our enrollment recording. Because ideally we should be able to have "multiple triggers", which leads to multiple enrollments at a time, with the valid one being the oldest active one...
@eri-trabiccolo wrote:
I think that if there is at least one valid enrollment, then the user should have access. Storing only one of those triggers makes it difficult to determine the overall enrollment status. This PR only handles membership auto-enroll triggers. I will open up a new issue with our thoughts about redesigning enrollment recording. |
@pondermatic wrote:
I agree.
Totally agree, in the future we want to overhaul the enrollment's recording.
Yeah, |
My first thought was that when unenrolling a course triggered by an order is handled elsewhere in the code, but I'll have a look at it. At the very least, I'll open an issue. |
You mean in a different method? Yeah sure.
( lifterlms/includes/models/model.llms.student.php Line 1489 in 3be2130
|
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.
so, to summarize:
#2064 (comment)
Description
Prevent course enrollment changes while removing a user's membership level if the user was auto-enrolled in the course by a different membership.
Fixes #1861
How has this been tested?
Manually and with a new unit test.
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: