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

Duplicating quiz with random question has exponential questions growth

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Log in as a teacher in a course.
      2. Create a course
      3. Turn editing on.
      4. Create a quiz
      5. Edit the quiz and add a new True/false question under the course's default question category.
      6. Add a "random question" to the quiz using the course's default question category
      7. Go back to the course page
      8. Duplicate the quiz
      9. Duplicate the quiz again
      10. Duplicate the quiz yet again
      11. Check the question table on the database. (It's most likely mdl_question). You should see 9 questions on the table.
      12. Open a terminal, go to your Moodle instance's root directory and run

        php admin/tool/task/cli/schedule_task.php --execute=\\qtype_random\\task\\remove_unused_questions
        

      13. Confirm that you see a message that 4 unused random questions have been cleaned up.
      14. Check the question table.
      15. Confirm that only 5 questions now remain.
      Show
      Log in as a teacher in a course. Create a course Turn editing on. Create a quiz Edit the quiz and add a new True/false question under the course's default question category. Add a "random question" to the quiz using the course's default question category Go back to the course page Duplicate the quiz Duplicate the quiz again Duplicate the quiz yet again Check the question table on the database. (It's most likely mdl_question). You should see 9 questions on the table. Open a terminal, go to your Moodle instance's root directory and run php admin/tool/task/cli/schedule_task.php --execute=\\qtype_random\\task\\remove_unused_questions Confirm that you see a message that 4 unused random questions have been cleaned up. Check the question table. Confirm that only 5 questions now remain.
    • Affected Branches:
      MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_35_STABLE, MOODLE_36_STABLE
    • Pull from Repository:
    • Pull 3.5 Branch:
    • Pull 3.6 Branch:
    • Pull Master Branch:

      Description

      Reproduction steps

      1. Install Moodle
      2. Create a course
      3. Go to Question Bank and create a "True/False" question in the course's default category
      4. Create a quiz in the course
      5. Add a "random question" to the quiz using the course's default question category
      6. Duplicate the quiz
      7. Duplicate the quiz again
      8. Duplicate the quiz yet again

      Expected result

      The mdl_question table contains 5 rows:

      • 1 row containing the "True/False" question created in step 3
      • 1 row containing the "random question" added in step 5
      • 1 row containing the "random question" from duplicating the quiz in step 6
      • 1 row containing the "random question" from duplicating the quiz in step 7
      • 1 row containing the "random question" from duplicating the quiz in step 8

      Actual result

      The mdl_question table contains 9 rows:

      • 1 row containing the "True/False" question created in step 3
      • 1 row containing the "random question" added in step 5
      • 1 row containing the "random question" from duplicating the quiz in step 6
      • 2 rows containing the "random question" from duplicating the quiz in step 7
      • 4 rows containing the "random question" from duplicating the quiz in step 8

       

      The number of questions created through duplicating the quiz seems to have exponential growth.

       

        Attachments

        1. MDL-63260-bO-2018-10-07.diff
          2 kB
        2. delete-4quizQuery.png
          delete-4quizQuery.png
          172 kB
        3. random.zip
          26 kB
        4. MDL-63260.PNG
          MDL-63260.PNG
          205 kB
        5. server1.png
          server1.png
          46 kB
        6. server2.png
          server2.png
          166 kB

          Issue Links

            Activity

              People

              • Votes:
                17 Vote for this issue
                Watchers:
                34 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  14/Jan/19

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 30 minutes
                  30m