Skip to content

Commit a22759a

Browse files
committed
fix: increase subsection grades rounding precision (openedx#1397)
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)
1 parent 85af65b commit a22759a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/course-home/data/__snapshots__/redux.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ Object {
782782
"gradingPolicy": Object {
783783
"assignmentPolicies": Array [
784784
Object {
785-
"averageGrade": "1.00",
785+
"averageGrade": "1.0000",
786786
"numDroppable": 1,
787787
"shortLabel": "HW",
788788
"type": "Homework",

src/course-home/data/api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const calculateAssignmentTypeGrades = (points, assignmentWeight, numDroppable) =
1818
// Calculate the average grade for the assignment and round it. This rounding is not ideal and does not accurately
1919
// reflect what a learner's grade would be, however, we must have parity with the current grading behavior that
2020
// exists in edx-platform.
21-
averageGrade = (points.reduce((a, b) => a + b, 0) / points.length).toFixed(2);
21+
averageGrade = (points.reduce((a, b) => a + b, 0) / points.length).toFixed(4);
2222
weightedGrade = averageGrade * assignmentWeight;
2323
}
2424
return { averageGrade, weightedGrade };

0 commit comments

Comments
 (0)