diff --git a/lms/djangoapps/grades/course_grade.py b/lms/djangoapps/grades/course_grade.py index dcc5bf363b..fb8181d7da 100644 --- a/lms/djangoapps/grades/course_grade.py +++ b/lms/djangoapps/grades/course_grade.py @@ -12,6 +12,7 @@ from django.conf import settings from django.utils.encoding import python_2_unicode_compatible from lazy import lazy +from openedx.core.lib.grade_utils import round_away_from_zero from xmodule import block_metadata_utils from .config import assume_zero_if_absent @@ -296,7 +297,9 @@ class CourseGrade(CourseGradeBase): Computes and returns the grade percentage from the given result from the grader. """ - return round(grader_result['percent'] * 100 + 0.05) / 100 + + # Confused about the addition of .05 here? See https://openedx.atlassian.net/browse/TNL-6972 + return round_away_from_zero(grader_result['percent'] * 100 + 0.05) / 100 @staticmethod def _compute_letter_grade(grade_cutoffs, percent): diff --git a/lms/djangoapps/instructor/tests/test_spoc_gradebook.py b/lms/djangoapps/instructor/tests/test_spoc_gradebook.py index 078d753c66..1fa34bbf04 100644 --- a/lms/djangoapps/instructor/tests/test_spoc_gradebook.py +++ b/lms/djangoapps/instructor/tests/test_spoc_gradebook.py @@ -104,11 +104,11 @@ class TestDefaultGradingPolicy(TestGradebook): # Users 1-10 attempted any homework (and get Fs) [10] # Users 4-10 scored enough to not get rounded to 0 for the class (and get Fs) [7] # One use at top of the page [1] - self.assertEqual(22, self.response.content.count(b'grade_F')) + self.assertEqual(23, self.response.content.count(b'grade_F')) # All other grades are None [29 categories * 11 users - 27 non-empty grades = 292] # One use at the top of the page [1] - self.assertEqual(293, self.response.content.count(b'grade_None')) + self.assertEqual(292, self.response.content.count(b'grade_None')) class TestLetterCutoffPolicy(TestGradebook):