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

Quiz grades are not saved properly when the submitter is not the user taking the quiz.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Trivial Trivial
    • 2.1.5, 2.2.2
    • 2.1.4, 2.2.1, 2.3
    • Quiz
    • None
    • MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • MOODLE_21_STABLE, MOODLE_22_STABLE
    • Easy
    • Hide

      The main thing is to test there are no regressions.

      1. Create a quiz that allows two attempts.
      2. Preview it as teacher. Verify that there are no errors, particularly when doing submit all and finish.
      3. Attempt the quiz as a student. Verify that there are no errors, particularly when doing submit all and finish. Then verify that the grade is displayed correct on the quiz view.php page and in the gradebook.
      4. Now make a second attempt as a student getting a different (higher) grade. Verify that the grade is updated on view.php and in the gradebook.

      5. If you really want to test this thoroughly, Create a script that submits open quiz attempts belonging to someone other than the logged in user, and then make sure that it works. However, I really don't think that is necessary.

      Show
      The main thing is to test there are no regressions. 1. Create a quiz that allows two attempts. 2. Preview it as teacher. Verify that there are no errors, particularly when doing submit all and finish. 3. Attempt the quiz as a student. Verify that there are no errors, particularly when doing submit all and finish. Then verify that the grade is displayed correct on the quiz view.php page and in the gradebook. 4. Now make a second attempt as a student getting a different (higher) grade. Verify that the grade is updated on view.php and in the gradebook. 5. If you really want to test this thoroughly, Create a script that submits open quiz attempts belonging to someone other than the logged in user, and then make sure that it works. However, I really don't think that is necessary.

      Currently, the finish_attempt() function updates the quiz grade for the currently logged in user ($USER) no matter whose quiz attempt is being finished. The cause is the following line:

      quiz_save_best_grade($this->get_quiz());

      As a result, the finished attempt grade is never pushed to the gradebook. It would make more sense for finish_attempt() to update the grade for the user whose quiz attempt is being closed, a la:

      quiz_save_best_grade($this->get_quiz(), $this->attempt->userid);

      As far as I know, this does't currently cause issues in the Moodle core code, because Quiz attempts are always submitted by the owning user. Plugins which use question_usage_by_activity are affected; and this will likely cause issues with MDL-3030, when that comes to fruition.

            timhunt Tim Hunt
            ktemkin Kyle Temkin
            Tim Hunt Tim Hunt
            Aparup Banerjee Aparup Banerjee
            Ankit Agarwal Ankit Agarwal
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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