Skip to content

Commit

Permalink
MDL-64161 gradereport_singleview: Stop updating grades with errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
abgreeve committed Nov 26, 2018
1 parent 599703e commit f246252
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions grade/report/singleview/classes/local/screen/screen.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,10 @@ public function process($data) {
// 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;
Expand Down
4 changes: 3 additions & 1 deletion grade/report/singleview/classes/local/ui/finalgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,11 @@ public function set($value) {
}
$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 '';
}
}

0 comments on commit f246252

Please sign in to comment.