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

DB inconsistency at group submissions / nopermissiontocomment at assignment view

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Cannot Reproduce
    • 2.6.1, 3.2.2
    • None
    • Assignment
    • MOODLE_26_STABLE, MOODLE_32_STABLE

    Description

      I've found an inconsistency at the assignment plugin.

      If a teacher changes the group of a student, which did a submission on a group assignment earlier. Than the student, which did the submission, can't view the assignment anymore and gets a "nopermissiontocomment" exception (with half of the side loaded).

      It was a struggle to find that error, since we got only the report of a trainer saying, that the assignment can't be viewed by some students. And therefore I don't think there is an easy fix for this.

      Edit: I can give this additional information as well. It may lead to a solution of this issue, but it's hard to decide, which direction this should go. I don't know that for sure, but it seems reasonable for me, that, if it is a group assignment and somebody has submited a solution, there will be created 2 entries in the assign_submission table. One for the student and one for the group. If the group of the student is changed both entries are untouched, which results in status "submitted for grading" for the user and "no submission" for the group in which he's moved. This conflict is badly resolved by moodle and gives the mistakable error message "nopermissiontocomment", which is thrown by line 61 of /mod/assign/submission/comments/lib.php as an result of assignsubmission_comments_comment_validate() in line 33 of the same file.

      Assume a changed group after a successful submission of a student, called "the student".

      Consider:

      /mod/assign/submission/comment/lib.php:55-62

      $group = $assignment->get_submission_group($USER->id);
      $groupid = 0;
      if ($group) {
          $groupid = $group->id;
      }
      if ($groupid != $submission->groupid) {
          throw new comment_exception('nopermissiontocomment');
      }
      

      In our case $group will be the new one, in which the student was moved and $submission->groupid will be the old one, in which he submitted his solution. Therefore, $groupid wont be same as $submission->groupid.

      The reason, why moodle evaluates this statement at all is located at line 640 of /mod/assign/renderer.php. it says:

      /mod/assign/renderer.php:640-641

      $submission = $status->teamsubmission ? $status->teamsubmission : $status->submission;
      if ($submission) {
      

      Conclusion: Team has no submission, but the student has this entry from earlier, which leads to true for him, but false for all other group members. After that there is a series of renderer called which leads to the the if-statement mentioned above and to the exception.

      Edit: The whole backtrace is:

      Debug info: Error code: nopermissiontocomment: Stack trace

          line 61 of /mod/assign/submission/comments/lib.php: comment_exception thrown
          line ? of unknownfile: call to assignsubmission_comments_comment_validate()
          line 7366 of /lib/moodlelib.php: call to call_user_func_array()
          line 7348 of /lib/moodlelib.php: call to component_callback()
          line 828 of /comment/lib.php: call to plugin_callback()
          line 839 of /comment/lib.php: call to comment->validate()
          line 415 of /comment/lib.php: call to comment->can_view()
          line 73 of /mod/assign/submission/comments/locallib.php: call to comment->output()
          line 890 of /mod/assign/renderer.php: call to assign_submission_comments->view_summary()
          line 221 of /lib/outputrenderers.php: call to mod_assign_renderer->render_assign_submission_plugin_submission()
          line 661 of /mod/assign/renderer.php: call to plugin_renderer_base->render()
          line 221 of /lib/outputrenderers.php: call to mod_assign_renderer->render_assign_submission_status()
          line 3628 of /mod/assign/locallib.php: call to plugin_renderer_base->render()
          line 3913 of /mod/assign/locallib.php: call to assign->view_student_summary()
          line 525 of /mod/assign/locallib.php: call to assign->view_submission_page()
          line 53 of /mod/assign/view.php: call to assign->view()
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              eberhardt Jan Eberhardt
              Adrian Greeve, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie
              Votes:
              15 Vote for this issue
              Watchers:
              18 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: