Merge pull request #8185 from AkA84/PLAT-295-reset-advertised-date-on-rerun

PLAT-295: Reset advertised date on course rerun

Thanks @AkA84 !
This commit is contained in:
John Eskew
2015-07-23 17:33:39 -04:00
2 changed files with 10 additions and 0 deletions

View File

@@ -1765,6 +1765,13 @@ class RerunCourseTest(ContentStoreTestCase):
self.assertEqual(1, len(source_videos))
self.assertEqual(source_videos, target_videos)
def test_rerun_course_resets_advertised_date(self):
source_course = CourseFactory.create(advertised_start="01-12-2015")
destination_course_key = self.post_rerun_request(source_course.id)
destination_course = self.store.get_course(destination_course_key)
self.assertEqual(None, destination_course.advertised_start)
def test_rerun_of_rerun(self):
source_course = CourseFactory.create()
rerun_course_key = self.post_rerun_request(source_course.id)

View File

@@ -786,6 +786,9 @@ def _rerun_course(request, org, number, run, fields):
# Mark the action as initiated
CourseRerunState.objects.initiated(source_course_key, destination_course_key, request.user, fields['display_name'])
# Clear the fields that must be reset for the rerun
fields['advertised_start'] = None
# Rerun the course as a new celery task
json_fields = json.dumps(fields, cls=EdxJSONEncoder)
rerun_course.delay(unicode(source_course_key), unicode(destination_course_key), request.user.id, json_fields)