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

Quiz review page error for uses with mod/quiz:preview, but not mod/quiz:viewreports

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.8.7, 2.9.1
    • Fix Version/s: 2.8.8, 2.9.2
    • Component/s: Quiz
    • Labels:
    • Testing Instructions:
      Hide

      Set-up: you need

      1. A course
      2. A question with an image in the questoin text.
      3. A quiz containing that question, where the options allow unlimited attempts and all the Review options are on.
      4. You need a test user Fred, enrolled in the course as a student. (Name does not actually matter )
      5. Override the permissions in that quiz, so that teachers do not have the mod/quiz:viewreports capability.

      Test the case that was buggy.

      1. Log in as Fred, and start an attempt.
      2. Log out and log in as admin, and give Fred's Teacher role in addition to Student.
      3. Log back in as Fred, and continue the attempt and Submit it.
      4. Verify that you can see the review, including the image in the question text.

      Test another case where the behaviour should not have changed:

      1. Log in as admin.
      2. Edit the quiz so that no review is allowed (Quiz settings -> Review options -> un-tick the 3 The attempt boxes that are not disabled.)
      3. Remove the teacher role from Fred.
      4. Log in as Fred and start a quiz attempt but don't submit.
      5. Log in as admin, and give Fred the teacher role again.
      6. Log in as Fred, continue the attempt, and submit. You should not be taken to the review page. Instead you should be taken back to the quiz intro page. (This is not a preview, review of non-preview attempts is not allowed.)
      7. As Fred start another attempt and submit it.
      8. This time you should see the review page (Since this was a preview attempt.)
      Show
      Set-up: you need A course A question with an image in the questoin text. A quiz containing that question, where the options allow unlimited attempts and all the Review options are on. You need a test user Fred, enrolled in the course as a student. (Name does not actually matter ) Override the permissions in that quiz, so that teachers do not have the mod/quiz:viewreports capability. Test the case that was buggy. Log in as Fred, and start an attempt. Log out and log in as admin, and give Fred's Teacher role in addition to Student. Log back in as Fred, and continue the attempt and Submit it. Verify that you can see the review, including the image in the question text. Test another case where the behaviour should not have changed: Log in as admin. Edit the quiz so that no review is allowed (Quiz settings -> Review options -> un-tick the 3 The attempt boxes that are not disabled.) Remove the teacher role from Fred. Log in as Fred and start a quiz attempt but don't submit. Log in as admin, and give Fred the teacher role again. Log in as Fred, continue the attempt, and submit. You should not be taken to the review page. Instead you should be taken back to the quiz intro page. (This is not a preview, review of non-preview attempts is not allowed.) As Fred start another attempt and submit it. This time you should see the review page (Since this was a preview attempt.)
    • Affected Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      In that case, a user will see a fatal error (throw new moodle_quiz_exception($attemptobj->get_quizobj(), 'noreviewattempt'); on line 75 of review.php) wheras review should be allowed

      Steps to reproduce:

      1. You need a quiz in a course, set up so that review is always allowed.
      2. You need a test user Fred, who is initially enrolled in the course as a student.
      3. Log in as Fred, and start an attempt.
      4. Log out and log in as admin, and give Fred's Teacher role in addition to Student.
      5. Also, override the permissions in that quiz, so that teachers do not have mod/quiz:viewreports capability.
      6. Log back in as Fred, and continue the attempt and Submit it.

      Expected result: Fred can see the review.

      Actual result:

      You are not allowed to review this attempt.

      More information about this error

      Debug info:
      Error code: noreviewattempt
      Stack trace:
      line 75 of /mod/quiz/review.php: moodle_quiz_exception thrown

        Attachments

          Activity

            People

            • Assignee:
              timhunt Tim Hunt
              Reporter:
              timhunt Tim Hunt
              Integrator:
              David Monllaó
              Tester:
              Ryan Wyllie
              Participants:
              Component watchers:
              Tim Hunt, Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/Sep/15