MDL-47059 Grades: Update the grade_grade if the finalgrade/or the grademax has changed.

Part of: MDL-46576
This commit is contained in:
Damyon Wiese 2014-09-19 10:27:05 +08:00 committed by Adrian Greeve
parent 1577229f93
commit 90cc8ce7c4

View File

@ -677,10 +677,12 @@ class grade_category extends grade_object {
$finalgrade = grade_grade::standardise_score($agg_grade, 0, 1, $result['grademin'], $result['grademax']);
$grade->finalgrade = $this->grade_item->bounded_grade($finalgrade);
$oldrawgrademax = $grade->rawgrademax;
$grade->rawgrademax = $result['grademax'];
// update in db if changed
if (grade_floats_different($grade->finalgrade, $oldfinalgrade)) {
if (grade_floats_different($grade->finalgrade, $oldfinalgrade) ||
grade_floats_different($grade->rawgrademax, $oldrawgrademax)) {
$grade->update('aggregation');
}