fix: increase subsection grades rounding precision (#1397)

We used two decimal digits to match the experience from the edx-platform.
However, https://github.com/openedx/edx-platform/pull/27788 increased
the precision to reduce the impact of double rounding.
This commit is contained in:
Piotr Surowiec
2024-09-23 20:39:15 +02:00
committed by GitHub
parent 1d19ae0e7b
commit e4a0105042
2 changed files with 2 additions and 2 deletions

View File

@@ -782,7 +782,7 @@ exports[`Data layer integration tests Test fetchProgressTab Should fetch, normal
"gradingPolicy": {
"assignmentPolicies": [
{
"averageGrade": "1.00",
"averageGrade": "1.0000",
"numDroppable": 1,
"shortLabel": "HW",
"type": "Homework",

View File

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