Merge pull request #13357 from edx/aj/ECOM-5405-update-bulk-enroll-mgm
Update each enrollment in atomic transaction not all
This commit is contained in:
@@ -91,9 +91,10 @@ class Command(BaseCommand):
|
||||
if not commit:
|
||||
logger.info('Dry run, changes have not been saved. Run again with "commit" argument to save changes')
|
||||
raise Exception('The --commit flag was not given; forcing rollback.')
|
||||
with transaction.atomic():
|
||||
# call `change_mode` which will change the mode and also emit tracking event
|
||||
for enrollment in course_enrollments:
|
||||
|
||||
# call `change_mode` which will change the mode and also emit tracking event
|
||||
for enrollment in course_enrollments:
|
||||
with transaction.atomic():
|
||||
enrollment.change_mode(mode=to_mode)
|
||||
|
||||
logger.info('Finished moving users from %s to %s in course %s.', from_mode, to_mode, course_key_str)
|
||||
|
||||
Reference in New Issue
Block a user