Moodle
  1. Moodle
  2. MDL-39971

Each attempt builds on the last fails when starting a second preview

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.4
    • Fix Version/s: 2.3.8, 2.4.5, 2.5.1
    • Component/s: Quiz
    • Labels:
    • Testing Instructions:
      Hide

      1. Create a quiz with Each attempt builds on last set, and allowing mulitple attempsts.

      2. Preview the quiz as a teacher. At the end, get back to the start, and click the Start another attempt button on the Quiz info page.

      3. In the middle of that second preview, click that Start a new preview button.

      4. Now attempt the quiz twice as a student, enduring that the second attempt starts with all the responses from your first attempt loaded into the questions.

      5. Now assign the student the role non-editing teacher in the quiz context.

      6. Now the student can preview the quiz. Do so twice, and verify that works.

      Show
      1. Create a quiz with Each attempt builds on last set, and allowing mulitple attempsts. 2. Preview the quiz as a teacher. At the end, get back to the start, and click the Start another attempt button on the Quiz info page. 3. In the middle of that second preview, click that Start a new preview button. 4. Now attempt the quiz twice as a student, enduring that the second attempt starts with all the responses from your first attempt loaded into the questions. 5. Now assign the student the role non-editing teacher in the quiz context. 6. Now the student can preview the quiz. Do so twice, and verify that works.
    • Affected Branches:
      MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Pull from Repository:
    • Pull 2.4 Branch:
    • Pull 2.5 Branch:
    • Pull Master Branch:
    • Rank:
      50711

      Description

      As I said in summary:

      1. Create a test with following settings
        • Multiple attempts (I did "unlimited")
        • Turn "Each attempt builds on the last" on
        • Restrict access (I did "institution" contains "FGWT"), which the admin doesn't match
      2. Do the test completely (with submission)
      3. Try to repeat the test

      Then you get following Exception:

      Debug Info: Failed to load questions_usage_by_activity
      Error code:
        codingerror
      Stack trace:
        line 342 of /question/engine/datalib.php: coding_exception thrown
        line 78 of /question/engine/lib.php: call to question_engine_data_mapper->load_questions_usage_by_activity()
        line 224 of /mod/quiz/startattempt.php: call to question_engine::load_questions_usage_by_activity()
      

        Activity

        Hide
        Tim Hunt added a comment -

        The bit about Restrict access is irrelevant.

        I think this fix is right, are you able to try it out.

        Show
        Tim Hunt added a comment - The bit about Restrict access is irrelevant. I think this fix is right, are you able to try it out.
        Hide
        Jan Eberhardt added a comment -

        Hm... I experienced, that if I disable the restriction, that the second preview is going well.

        That's the reason I mentioned this bit about the restricted access.

        Show
        Jan Eberhardt added a comment - Hm... I experienced, that if I disable the restriction, that the second preview is going well. That's the reason I mentioned this bit about the restricted access.
        Hide
        Tim Hunt added a comment -

        Again, long time with no peer review, and this fixes a significant fatal error with these particular settings. Submitting for integration review.

        Show
        Tim Hunt added a comment - Again, long time with no peer review, and this fixes a significant fatal error with these particular settings. Submitting for integration review.
        Hide
        Sam Hemelryk added a comment -

        Thanks Tim, this has been integrated now.

        Show
        Sam Hemelryk added a comment - Thanks Tim, this has been integrated now.
        Hide
        Ankit Agarwal added a comment -

        On step 6, the preview is build on top of previous responses from the user , is that expected, even if it is a preview?

        Show
        Ankit Agarwal added a comment - On step 6, the preview is build on top of previous responses from the user , is that expected, even if it is a preview?
        Hide
        Ankit Agarwal added a comment -

        passing as the same behaviour is present in stable as well. Let me know if you want me to create a issue for it.
        Cheers

        Show
        Ankit Agarwal added a comment - passing as the same behaviour is present in stable as well. Let me know if you want me to create a issue for it. Cheers
        Hide
        Marina Glancy added a comment -

        Thanks for your awesome work! This has now become a part of Moodle.

        Closing as fixed!

        Show
        Marina Glancy added a comment - Thanks for your awesome work! This has now become a part of Moodle. Closing as fixed!
        Hide
        Tim Hunt added a comment -

        Just to confirm that what Ankit observed at step 6 is the expected behaviour.

        Show
        Tim Hunt added a comment - Just to confirm that what Ankit observed at step 6 is the expected behaviour.

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: