MDL-64161 gradereport_singleview: Stop updating grades with errors.

This commit is contained in:
Adrian Greeve 2018-11-26 10:56:28 +08:00
parent 599703e83d
commit f2462522f6
2 changed files with 7 additions and 1 deletions

View File

@ -355,6 +355,10 @@ abstract class screen {
// Optional type.
if (!empty($msg)) {
$warnings[] = $msg;
if ($element instanceof \gradereport_singleview\local\ui\finalgrade) {
// This item wasn't changed so don't add to the changecount.
continue;
}
}
if (preg_match('/_(\d+)_(\d+)/', $varname, $matchelement)) {
$changecount[$matchelement[0]] = 1;

View File

@ -170,9 +170,11 @@ class finalgrade extends grade_attribute_format implements unique_value, be_disa
}
$gradestr->itemname = $this->grade->grade_item->get_name();
$errorstr = get_string($errorstr, 'grades', $gradestr);
return $errorstr;
}
// Only update grades if there are no errors.
$gradeitem->update_final_grade($userid, $finalgrade, 'singleview', $feedback, FORMAT_MOODLE);
return $errorstr;
return '';
}
}