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

Avoid removing Course access when unenrolling student in membership #2705

Conversation

brianhogg
Copy link
Contributor

@brianhogg brianhogg commented Aug 2, 2024

Description

Check the current auto-enroll courses list for other memberships a student is a part of before unenrolling the student from a course.

Note that when a student is unenrolled from a membership, we're only maybe unenrolling them from courses that they were not already enrolled in when they were enrolled in the membership. For example:

  • Student not enrolled in any courses
  • Student enrolled in membership A which auto-enrolls in course A and B
  • Student enrolled in membership B which auto-enrolls in course B

Because the student was already enrolled in course A and B, there is no new enrollment record created for course B, so they'll never be unenrolled automatically in course B when they are unenrolled from membership B. This is existing behaviour that would either need a change for what courses we look to remove them from (ie. the current auto-enroll courses list, which may have changed since the student was enrolled in the first place) or creating multiple enrollment triggers that can be checked upon unenrollment in the membership.

  • Edit: Now creates a new enrollment record for the membership that is keeping them in the course

Fixes #1861

How has this been tested?

Manually and via PHPUnit test

Checklist:

  • This PR requires and contains at least one changelog file.
  • My code has been tested.
  • My code passes all existing automated tests.
  • My code follows the LifterLMS Coding & Documentation Standards.

…s keeping them enrolled via its auto-enroll settings.
@brianhogg brianhogg added this to the Next Available Release milestone Aug 2, 2024
@ideadude ideadude merged commit 7899dd2 into dev Aug 6, 2024
5 checks passed
@ideadude ideadude deleted the fix/unenroll-membership-removes-course-access-from-another-membership branch August 6, 2024 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants