Merge pull request #18977 from edx/prevent_activation_time_error

prevent activation time error
This commit is contained in:
Matthew Piatetsky
2018-09-21 12:21:11 -04:00
committed by GitHub

View File

@@ -288,7 +288,7 @@ class UserCourseEnrollmentsList(generics.ListAPIView):
courses_excluded_from_mobile = json.loads(courses_excluded_from_mobile.replace('\r', '').replace('\n', ''))
if enrollment.mode == 'audit' and str(course_key) in courses_excluded_from_mobile.keys():
activationTime = dateparse.parse_datetime(courses_excluded_from_mobile[str(course_key)])
if enrollment.created > activationTime:
if activationTime and enrollment.created and enrollment.created > activationTime:
return True
except (ExperimentKeyValue.DoesNotExist, AttributeError):
pass