Commit 16d6d23f by Feanil Patel

Save state before unenrolling student from old course.

parent 1be33651
...@@ -44,11 +44,14 @@ class Command(BaseCommand): ...@@ -44,11 +44,14 @@ class Command(BaseCommand):
# Move the Student between the classes. # Move the Student between the classes.
mode = enrollment.mode mode = enrollment.mode
old_is_active = enrollment.is_active
CourseEnrollment.unenroll(user,source) CourseEnrollment.unenroll(user,source)
new_enrollment = CourseEnrollment.enroll(user, dest, mode=mode) new_enrollment = CourseEnrollment.enroll(user, dest, mode=mode)
if not enrollment.is_active: # Unenroll from the new coures if the user had unenrolled
CourseEnrollment.unenroll(user,dest) # form the old course.
if not old_is_active:
new_enrollment.update_enrollment(is_active=False)
if mode == 'verified': if mode == 'verified':
try: 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