Skip to content

Commit

Permalink
Enabled 2f decimals for grade and score and removed default edx round…
Browse files Browse the repository at this point in the history
…off logic
  • Loading branch information
sabid-ansari committed Sep 13, 2024
1 parent 4e56d0b commit 32d74ff
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lms/djangoapps/grades/course_grade.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,10 @@ def _compute_percent(grader_result):
"""

# 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
#return round_away_from_zero(grader_result['percent'] * 100 + 0.05) / 100

#SA || gradeRoundOff
return grader_result['percent']

@staticmethod
def _compute_letter_grade(grade_cutoffs, percent):
Expand Down
4 changes: 3 additions & 1 deletion lms/djangoapps/grades/rest_api/v1/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,13 @@ def _serialize_section_grades(user, course_key, course_grade):
summary = []
for section in course_grade.summary.get('section_breakdown'):
summary.append(section)

#SA || gradeRoundOff
course_grading_status = {
'course_id': str(course_key),
'username': user.username,
'passed': course_grade.passed,
'current_grade': int(course_grade.percent * 100),
'current_grade': course_grade.percent * 100,
'section_breakdown': summary,
}
return course_grading_status
Expand Down
2 changes: 1 addition & 1 deletion lms/djangoapps/grades/scores.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def compute_percent(earned, possible):
"""
if possible > 0:
# Rounds to two decimal places.
return around(earned / possible, decimals=2)
return around(earned / possible, decimals=4)
else:
return 0.0

Expand Down

0 comments on commit 32d74ff

Please sign in to comment.