mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 09:26:35 +02:00
Another improvement on regrading. The code thought that grading for a question changed if the grade was like 1/3. The precision in the database is different than the newly calculated grade, so now we round both values to 5 decimal places, which should fix this problem. This was committed to STABLE by Julian a long time ago
This commit is contained in:
parent
27aa2243ea
commit
3bf0212c24
1 changed files with 5 additions and 2 deletions
|
@ -510,10 +510,13 @@ function quiz_regrade_question_in_attempt($question, $attempt, $cmoptions, $verb
|
|||
$attempt)) {
|
||||
$verbose && notify("Couldn't regrade state #{$state->id}!");
|
||||
}
|
||||
if ((float)$replaystate->raw_grade != (float)$states[$j]->raw_grade) {
|
||||
$changed++;
|
||||
|
||||
// We need rounding here because grades in the DB get truncated
|
||||
// e.g. 0.33333 != 0.3333333, but we want them to be equal here
|
||||
if (round((float)$replaystate->grade, 5) != round((float)$states[$j]->grade, 5)) {
|
||||
$changed++;
|
||||
}
|
||||
|
||||
$replaystate->id = $states[$j]->id;
|
||||
$replaystate->update = true;
|
||||
quiz_save_question_session($question, $replaystate);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue