MDL-56646 assign: Fix negative grades in restore

This commit is contained in:
John Okely
2017-08-29 07:15:08 +00:00
committed by John Okely
parent 76eefdded3
commit 127992bfaf
2 changed files with 5 additions and 2 deletions
@@ -243,7 +243,10 @@ class restore_assign_activity_structure_step extends restore_activity_structure_
$flags->userid = $this->get_mappingid('user', $data->userid);
$DB->insert_record('assign_user_flags', $flags);
}
// Fix null grades that were rescaled.
if ($data->grade < 0 && $data->grade != -1) {
$data->grade = -1;
}
$newitemid = $DB->insert_record('assign_grades', $data);
// Note - the old contextid is required in order to be able to restore files stored in
+1 -1
View File
@@ -8607,7 +8607,7 @@ class assign {
// Fix the grades.
$this->fix_null_grades();
set_config('has_rescaled_null_grades_' . $instance->id, 0, 'assign');
unset_config('has_rescaled_null_grades_' . $instance->id, 'assign');
// Display the notice.
$o .= $this->get_renderer()->notification(get_string('fixrescalednullgradesdone', 'assign'), 'notifysuccess');