Merge pull request #21661 from edx/BOM-481

BOM-481
This commit is contained in:
Aarif
2019-09-17 13:47:24 +05:00
committed by GitHub
2 changed files with 4 additions and 3 deletions

View File

@@ -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

View File

@@ -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(