fix: add missing end field (#34880)

* fix: add missing end field

* fix: lint and test errors
This commit is contained in:
Kristin Aoki
2024-05-31 09:42:53 -04:00
committed by GitHub
parent 3b2971e99d
commit 1ef4c0d7a2
2 changed files with 3 additions and 3 deletions

View File

@@ -104,10 +104,9 @@ class TestCourseListing(ModuleStoreTestCase):
dest_course_key = CourseKey.from_string(data['destination_course_key'])
self.assertEqual(dest_course_key.run, 'copy')
source_course = self.store.get_course(self.source_course_key)
dest_course = self.store.get_course(dest_course_key)
self.assertEqual(dest_course.start, CourseFields.start.default)
self.assertEqual(dest_course.end, source_course.end)
self.assertEqual(dest_course.end, None)
self.assertEqual(dest_course.enrollment_start, None)
self.assertEqual(dest_course.enrollment_end, None)
course_orgs = get_course_organizations(dest_course_key)

View File

@@ -878,6 +878,7 @@ def _create_or_rerun_course(request):
display_name = request.json.get('display_name')
# force the start date for reruns and allow us to override start via the client
start = request.json.get('start', CourseFields.start.default)
end = request.json.get('end', CourseFields.end.default)
run = request.json.get('run')
has_course_creator_role = is_content_creator(request.user, org)
@@ -892,7 +893,7 @@ def _create_or_rerun_course(request):
status=400
)
fields = {'start': start}
fields = {'start': start, 'end': end}
if display_name is not None:
fields['display_name'] = display_name