Fix a rounding error with SingleProblemGrader point values. #2613
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When computing the point value in the SingleProblemGrader, the database saves 6 decimal digits in the status field, while the single problem grader only saved 2. This difference in rounding can cause the computation of the point value with a stepSize of 0.25 to get get different values between the computed score and the score saved in the database, causing the "Use points from last check" button to show up and present a different rounded value.
This fixes the issue by saving the current score in a
$rawCurrnetScore
variable that isn't rounded and using that for the point computation. Note,$rawCurrentScore
can have more than the 6 decimal digits in the saved database score, but rounding this to match the database won't improve the accuracy of the point value rounded to the nearest stepSize.Note I noticed this issue with questions with multiple parts with 12-14 points causing a 0.25 stepSize.