Skip to content
Snippets Groups Projects
Commit ce7b094c authored by Emma Green's avatar Emma Green
Browse files

don't error out to user programs with really old course runs not in lms

parent e39e6e9f
Branches
Tags
No related merge requests found
......@@ -494,10 +494,19 @@ class ProgramDataExtender(object):
for course_run in course['course_runs']:
# State to be shared across handlers.
self.course_run_key = CourseKey.from_string(course_run['key'])
self.course_overview = CourseOverview.get_from_id(self.course_run_key)
self.enrollment_start = self.course_overview.enrollment_start or DEFAULT_ENROLLMENT_START_DATE
self._execute('_attach_course_run', course_run)
# Some (old) course runs may exist for a program which do not exist in LMS. In that case,
# continue without the course run.
try:
self.course_overview = CourseOverview.get_from_id(self.course_run_key)
except CourseOverview.DoesNotExist:
log.warning('Failed to get course overview for course run key: %s',
self.course_run.get('key'),
exec_info=True)
else:
self.enrollment_start = self.course_overview.enrollment_start or DEFAULT_ENROLLMENT_START_DATE
self._execute('_attach_course_run', course_run)
def _attach_course_run_certificate_url(self, run_mode):
certificate_data = certificate_api.certificate_downloadable_status(self.user, self.course_run_key)
......
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