MDL-48574 assign: Fire workflow_state_updated event on batch and single.
This change adds the workflow_state_updated event when changing workflow state using the single grading page and the quick grading mechanisms. Previously, it only fired for batch updates using process_set_batch_marking_workflow_state().
This commit is contained in:
+11
-2
@@ -5380,7 +5380,10 @@ class assign {
|
||||
$flags->allocatedmarker = $modified->allocatedmarker;
|
||||
}
|
||||
if ($workflowstatemodified || $allocatedmarkermodified) {
|
||||
$this->update_user_flags($flags);
|
||||
if ($this->update_user_flags($flags) && $workflowstatemodified) {
|
||||
$user = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST);
|
||||
\mod_assign\event\workflow_state_updated::create_from_user($this, $user, $flags->workflowstate)->trigger();
|
||||
}
|
||||
}
|
||||
$this->update_grade($grade);
|
||||
|
||||
@@ -6625,9 +6628,15 @@ class assign {
|
||||
}
|
||||
if (isset($formdata->workflowstate) || isset($formdata->allocatedmarker)) {
|
||||
$flags = $this->get_user_flags($userid, true);
|
||||
$oldworkflowstate = $flags->workflowstate;
|
||||
$flags->workflowstate = isset($formdata->workflowstate) ? $formdata->workflowstate : $flags->workflowstate;
|
||||
$flags->allocatedmarker = isset($formdata->allocatedmarker) ? $formdata->allocatedmarker : $flags->allocatedmarker;
|
||||
$this->update_user_flags($flags);
|
||||
if ($this->update_user_flags($flags) &&
|
||||
isset($formdata->workflowstate) &&
|
||||
$formdata->workflowstate !== $oldworkflowstate) {
|
||||
$user = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST);
|
||||
\mod_assign\event\workflow_state_updated::create_from_user($this, $user, $formdata->workflowstate)->trigger();
|
||||
}
|
||||
}
|
||||
}
|
||||
$grade->grader= $USER->id;
|
||||
|
||||
Reference in New Issue
Block a user