Commit 16d6d23f by Feanil Patel

Save state before unenrolling student from old course.

parent 1be33651
......@@ -44,11 +44,14 @@ class Command(BaseCommand):
# Move the Student between the classes.
mode = enrollment.mode
old_is_active = enrollment.is_active
CourseEnrollment.unenroll(user,source)
new_enrollment = CourseEnrollment.enroll(user, dest, mode=mode)
if not enrollment.is_active:
CourseEnrollment.unenroll(user,dest)
# Unenroll from the new coures if the user had unenrolled
# form the old course.
if not old_is_active:
new_enrollment.update_enrollment(is_active=False)
if mode == 'verified':
try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment