From f738e74e7e867e70dd3671077983a59ed3998249 Mon Sep 17 00:00:00 2001 From: Matthew Piatetsky Date: Wed, 19 Sep 2018 17:06:15 -0400 Subject: [PATCH] prevent activation time error --- lms/djangoapps/mobile_api/users/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/djangoapps/mobile_api/users/views.py b/lms/djangoapps/mobile_api/users/views.py index e5adb1c20c..796ef55bfd 100644 --- a/lms/djangoapps/mobile_api/users/views.py +++ b/lms/djangoapps/mobile_api/users/views.py @@ -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