MDL-52566 mod/assign: Fix group submission draft records
When group assignments are submitted by the first student in a group, the logic that saves the submission is not creating a draft assignment record in mdl_assign_submission. This leads to problems when other functions are used that depend on these records, such as marking workflow. This fixes the issue and correctly creates draft assignment submission records for the non-submitting students in the group.
This commit is contained in:
@@ -5986,6 +5986,17 @@ class assign {
|
||||
|
||||
$this->update_submission($submission, $userid, true, $instance->teamsubmission);
|
||||
|
||||
if ($instance->teamsubmission && !$instance->requireallteammemberssubmit) {
|
||||
$team = $this->get_submission_group_members($submission->groupid, true);
|
||||
|
||||
foreach ($team as $member) {
|
||||
if ($member->id != $userid) {
|
||||
$membersubmission = clone($submission);
|
||||
$this->update_submission($membersubmission, $member->id, true, $instance->teamsubmission);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Logging.
|
||||
if (isset($data->submissionstatement) && ($userid == $USER->id)) {
|
||||
\mod_assign\event\statement_accepted::create_from_submission($this, $submission)->trigger();
|
||||
|
||||
Reference in New Issue
Block a user