Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-59195

Assignments and switch role to student: Error with viewing assignment with group submitting

XMLWordPrintable

    • MOODLE_33_STABLE
    • MOODLE_32_STABLE, MOODLE_33_STABLE
    • MDL-59195_assign_comment_permissions
    • Hide
      1. Login as teacher in a course and turn editing on
      2. Create a new assignment activity, enter a title and just set the following option in the section Group submission settings: Students submit in groups: Yes.
      3. Save and return to course
      4. Switch role to...: Student
      5. Click on the newly added assignment
      6. Expected result: assignment can be viewed, without an error message
      Show
      Login as teacher in a course and turn editing on Create a new assignment activity, enter a title and just set the following option in the section Group submission settings: Students submit in groups: Yes. Save and return to course Switch role to...: Student Click on the newly added assignment Expected result: assignment can be viewed, without an error message

      Hi there,

      we encountered a bug with the "switch role to" feature together with assignments that can be submitted in group mode.

      • Steps to reproduce:
      1. Login as teacher in a course and turn editing on
      2. Create a new assignment activity, enter a title and just set the following option in the section Group submission settings: Students submit in groups: Yes.
      3. Save and return to course
      4. Switch role to...: Student
      5. Click on the newly added assignment

      Result:
      It opens a page with broken CSS with the error message: You can't add comments:

      This also happens if you create a group and enrole yourself as a teacher in this group and also if setting Require group to make submission is set to yes.

      • Cause:
        In the function assignsubmission_comments_comment_validate() in mod/assign/submission/comments/lib.php we ran into this error:

        66 if (!$canview) {
        67        throw new comment_exception('nopermissiontocomment');
        68    }
        

        The cause is that $canview will be false because the teacher will never be added as a submitting member for an assignment in the called line $canview = $assignment->can_view_submission($submission->userid);
        Here's the corresponding code:
        mod/assign/locallib.php:

        4367    public function can_view_group_submission($groupid) {
        4368       global $USER;
        4369
        4370        $members = $this->get_submission_group_members($groupid, true);
        4371        foreach ($members as $member) {
        4372       if($member->id == 11964) {
        4373            error_log($member->id);
        4374            error_log("Can view submission: " . $this->can_view_submission($member->id));
        4375        }
        4376            // If we can view any members submission, we can view the submission for the group.
        4377            if ($this->can_view_submission($member->id)) {
        4378                return true;
        4379            }
        4380        }
        4381        return false;
        4382    }
        

            davosmith Davo Smith
            kosswa Kathrin Osswald
            Damyon Wiese Damyon Wiese
            Dan Poltawski Dan Poltawski
            John Okely John Okely
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.