Skip to content

Commit

Permalink
fix: increase subsection grades rounding precision (openedx#1397)
Browse files Browse the repository at this point in the history
We used two decimal digits to match the experience from the edx-platform.
However, openedx/edx-platform#27788 increased
the precision to reduce the impact of double rounding.

(cherry picked from commit e4a0105)
  • Loading branch information
Agrendalath committed Sep 24, 2024
1 parent 2815e3d commit 2691144
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/course-home/data/__snapshots__/redux.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ Object {
"gradingPolicy": Object {
"assignmentPolicies": Array [
Object {
"averageGrade": "1.00",
"averageGrade": "1.0000",
"numDroppable": 1,
"shortLabel": "HW",
"type": "Homework",
Expand Down
2 changes: 1 addition & 1 deletion src/course-home/data/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const calculateAssignmentTypeGrades = (points, assignmentWeight, numDroppable) =
// Calculate the average grade for the assignment and round it. This rounding is not ideal and does not accurately
// reflect what a learner's grade would be, however, we must have parity with the current grading behavior that
// exists in edx-platform.
averageGrade = (points.reduce((a, b) => a + b, 0) / points.length).toFixed(2);
averageGrade = (points.reduce((a, b) => a + b, 0) / points.length).toFixed(4);
weightedGrade = averageGrade * assignmentWeight;
}
return { averageGrade, weightedGrade };
Expand Down

0 comments on commit 2691144

Please sign in to comment.