fix: bound confirmed points and the attempt percentage

WR-05: Confirm clamps the grader's score to the question's current
points, so lowering a question's points no longer lets a confirm store
more than full marks, and Totals caps the percentage at 100 when a
question's points were raised after the attempt was scored.
This commit is contained in:
Jakub Zych
2026-11-09 22:50:26 +01:00
parent 1cba2c4d32
commit 09cf61e9e0
3 changed files with 15 additions and 4 deletions

View File

@@ -84,6 +84,7 @@ func TestTotals(t *testing.T) {
{[]float64{2, -0.5}, 4, 1.5, 37.5},
{nil, 0, 0, 0},
{[]float64{1}, 1, 1, 100},
{[]float64{3}, 2, 3, 100},
}
for _, tc := range cases {
score, pct := classes.Totals(tc.points, tc.max)