diff --git a/common/djangoapps/student/helpers.py b/common/djangoapps/student/helpers.py index 6a0c9fc740..fe82520fdb 100644 --- a/common/djangoapps/student/helpers.py +++ b/common/djangoapps/student/helpers.py @@ -568,8 +568,9 @@ def _cert_info(user, course_overview, cert_status): # who need to be regraded (we weren't tracking 'notpassing' at first). # We can add a log.warning here once we think it shouldn't happen. return default_info - - status_dict['grade'] = text_type(max(cert_grade_percent, persisted_grade_percent)) + grades_input = [cert_grade_percent, persisted_grade_percent] + max_grade = None if all(grade is None for grade in grades_input) else max(filter(lambda x: x is not None, grades_input)) + status_dict['grade'] = text_type(max_grade) return status_dict diff --git a/common/djangoapps/student/tests/tests.py b/common/djangoapps/student/tests/tests.py index 7cb7347b9b..ad451ae689 100644 --- a/common/djangoapps/student/tests/tests.py +++ b/common/djangoapps/student/tests/tests.py @@ -234,7 +234,7 @@ class CourseEndingTest(TestCase): Tests that the higher of the persisted grade and the grade from the certs table is used on the learner dashboard. """ - expected_grade = max(persisted_grade, cert_grade) + expected_grade = max(filter(lambda x: x is not None, [persisted_grade, cert_grade])) user = Mock(username="fred", id="1") survey_url = "http://a_survey.com" course = Mock(