Enhance the Link Program Enrollments Support Tool to handle the case of linking a learner to a ProgramEnrollment that is already linked to a different edX account.

In this case,
* unenroll the currently linked learner from the courses associated with related ProgramCourseEnrollments
* for each course the is enrolled in as part of a ProgramCourseEnrollment, if the coures has an audit track, then move the enrollment into the audit track. Otherwise, keep the learner's enrollment in the existing track.
* link the new user to the ProgramEnrollment
* enroll the new user in the Master's track in the courses associated with related ProgramCourseEnrollments
This commit is contained in:
Michael Roytman
2020-05-01 16:58:26 -04:00
parent 0e7a0b6d59
commit 38c255dbd2
6 changed files with 249 additions and 53 deletions

View File

@@ -545,6 +545,19 @@ class CourseMode(models.Model):
"""
return cls.PROFESSIONAL in modes_dict or cls.NO_ID_PROFESSIONAL_MODE in modes_dict
@classmethod
def contains_audit_mode(cls, modes_dict):
"""
Check whether the modes_dict contains an audit mode.
Args:
modes_dict (dict): a dict of course modes
Returns:
bool: whether modes_dict contains an audit mode
"""
return cls.AUDIT in modes_dict
@classmethod
def is_professional_mode(cls, course_mode_tuple):
"""