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

Question usage start_all_questions function does not use supplied parameters.

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Moodle 3.2, 3.3, and master

      1. Create a quiz and attempt it multiple times with the same student. Check that there are no errors relating to question attempts.

      Master only

      1. Revert this patch.
      2. In backup/moodle2/tests/restore_stepslib_date_test.php put a sleep after line 360 after:

        $attempt = quiz_create_attempt($quizobj, 1, false, $timenow, false, $user1->id);
        

      3. Run this unit test.
      4. Check that you get a failure in line with the description of this issue.
      5. Restore the patch and run the unit test again.
      6. The failure should be gone.
      Show
      Moodle 3.2, 3.3, and master Create a quiz and attempt it multiple times with the same student. Check that there are no errors relating to question attempts. Master only Revert this patch. In backup/moodle2/tests/restore_stepslib_date_test.php put a sleep after line 360 after: $attempt = quiz_create_attempt($quizobj, 1, false, $timenow, false, $user1->id); Run this unit test. Check that you get a failure in line with the description of this issue. Restore the patch and run the unit test again. The failure should be gone.
    • Affected Branches:
      MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE, MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      wip-MDL-59881-master
    • Sprint:
      3.4 Sprint 4

      Description

      question_usage_by_activity::start_all_questions has three parameters, but only uses the first one in the function.

      The restore_stepslib_date_test is periodically failing, because when it starts a new quiz attempt the timestamp is not utilized.

      Time: 13.9 minutes, Memory: 334.00MB
      There was 1 failure:
      1) restore_stepslib_date_testcase::test_question_attempt_steps_date_restore
      Failed asserting that '1503042635' matches expected 1503042636.
      /home/travis/build/snake/moodle/backup/moodle2/tests/restore_stepslib_date_test.php:410
      /home/travis/build/snake/moodle/lib/phpunit/classes/advanced_testcase.php:80
      
      

      This can be tested by adding a sleep(1) between the lines $attempt = quiz_create_attempt(... }} and {{quiz_start_new_attempt around line 360.

      To me this looks like an oversight as $qa->start takes a timestamp but is just not supplied the parameter. The same goes for userid (though this is not causing a unit test failure).

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/Sep/17