Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-36064: Assignment revert to draft causes error with Team assignme…

…nt changes
  • Loading branch information...
commit e1979700212bd36fb1edefbaded090affa1f58e2 1 parent f186ad1
Damyon Wiese authored

Showing 1 changed file with 7 additions and 3 deletions. Show diff stats Hide diff stats

  1. +7 3 mod/assign/locallib.php
10 mod/assign/locallib.php
@@ -4063,7 +4063,7 @@ public function add_submission_form_elements(MoodleQuickForm $mform, stdClass $d
4063 4063 * @return void
4064 4064 */
4065 4065 private function process_revert_to_draft($userid = 0) {
4066   - global $DB;
  4066 + global $DB, $USER;
4067 4067
4068 4068 // Need grade permission
4069 4069 require_capability('mod/assign:grade', $this->context);
@@ -4073,13 +4073,17 @@ private function process_revert_to_draft($userid = 0) {
4073 4073 $userid = required_param('userid', PARAM_INT);
4074 4074 }
4075 4075
4076   - $submission = $this->get_user_submission($userid, false);
  4076 + if ($this->get_instance()->teamsubmission) {
  4077 + $submission = $this->get_group_submission($USER->id, 0, false);
  4078 + } else {
  4079 + $submission = $this->get_user_submission($USER->id, false);
  4080 + }
4077 4081
4078 4082 if (!$submission) {
4079 4083 return;
4080 4084 }
4081 4085 $submission->status = ASSIGN_SUBMISSION_STATUS_DRAFT;
4082   - $this->update_submission($submission, $USER->id, true, $this->get_instance()->teamsubmission);
  4086 + $this->update_submission($submission, $userid, true, $this->get_instance()->teamsubmission);
4083 4087
4084 4088 // Update the modified time on the grade (grader modified).
4085 4089 $grade = $this->get_user_grade($userid, true);

0 comments on commit e197970

Please sign in to comment.
Something went wrong with that request. Please try again.