Skip to content

Commit

Permalink
MDL-71400 assignfeedback_offline: Fix message after worksheet upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihail Geshoski committed Apr 22, 2021
1 parent f63aed0 commit f065061
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Expand Up @@ -46,4 +46,4 @@
$string['skiprecord'] = 'Skip record';
$string['updaterecord'] = 'Update record';
$string['uploadgrades'] = 'Upload grading worksheet';
$string['updatedgrades'] = 'Updated {$a} grades and feedback';
$string['updatedgrades'] = 'Updated <strong>{$a->gradeupdatescount}</strong> grades and <strong>{$a->feedbackupdatescount}</strong> feedback instances.';
13 changes: 9 additions & 4 deletions mod/assign/feedback/offline/locallib.php
Expand Up @@ -131,7 +131,8 @@ public function process_import_grades($draftid, $importid, $ignoremodified, $enc
$adminconfig = $this->assignment->get_admin_config();
$gradebookplugin = $adminconfig->feedback_plugin_for_gradebook;

$updatecount = 0;
$updategradecount = 0;
$updatefeedbackcount = 0;
while ($record = $gradeimporter->next()) {
$user = $record->user;
$modified = $record->modified;
Expand Down Expand Up @@ -179,7 +180,7 @@ public function process_import_grades($draftid, $importid, $ignoremodified, $enc
$grade->grader = $USER->id;
if ($this->assignment->update_grade($grade)) {
$this->assignment->notify_grade_modified($grade);
$updatecount += 1;
$updategradecount += 1;
}
}

Expand All @@ -197,7 +198,7 @@ public function process_import_grades($draftid, $importid, $ignoremodified, $enc
}
}
if ($newvalue != $oldvalue) {
$updatecount += 1;
$updatefeedbackcount += 1;
$grade = $this->assignment->get_user_grade($record->user->id, true);
$this->assignment->notify_grade_modified($grade);
$plugin->set_editor_text($field, $newvalue, $grade->id);
Expand All @@ -222,7 +223,11 @@ public function process_import_grades($draftid, $importid, $ignoremodified, $enc
false,
$this->assignment->get_course_module()->id,
get_string('importgrades', 'assignfeedback_offline')));
$o .= $renderer->box(get_string('updatedgrades', 'assignfeedback_offline', $updatecount));
$strparams = [
'gradeupdatescount' => $updategradecount,
'feedbackupdatescount' => $updatefeedbackcount,
];
$o .= $renderer->box(get_string('updatedgrades', 'assignfeedback_offline', $strparams));
$url = new moodle_url('view.php',
array('id'=>$this->assignment->get_course_module()->id,
'action'=>'grading'));
Expand Down

0 comments on commit f065061

Please sign in to comment.