From 1731024991ee59629bf7123b5bf36220a8a36bfb Mon Sep 17 00:00:00 2001 From: Asad Ali Date: Wed, 26 Jun 2024 12:55:46 +0500 Subject: [PATCH] fix(external course sync): sync course run dates if they are missing --- courses/sync_external_courses/emeritus_api.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/courses/sync_external_courses/emeritus_api.py b/courses/sync_external_courses/emeritus_api.py index 2211369a3..636298101 100644 --- a/courses/sync_external_courses/emeritus_api.py +++ b/courses/sync_external_courses/emeritus_api.py @@ -391,13 +391,18 @@ def create_or_update_emeritus_course_run(course, emeritus_course): ) return course_run, True elif ( - course_run.start_date - and emeritus_course.start_date - and course_run.start_date.date() != emeritus_course.start_date.date() - ) or ( - course_run.end_date - and emeritus_course.end_date - and course_run.end_date.date() != emeritus_course.end_date.date() + (not course_run.start_date and emeritus_course.start_date) + or ( + course_run.start_date + and emeritus_course.start_date + and course_run.start_date.date() != emeritus_course.start_date.date() + ) + or (not course_run.end_date and emeritus_course.end_date) + or ( + course_run.end_date + and emeritus_course.end_date + and course_run.end_date.date() != emeritus_course.end_date.date() + ) ): course_run.start_date = emeritus_course.start_date course_run.end_date = emeritus_course.end_date