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

Minimise questions included with quiz backups (or duplication)

    • MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE, MOODLE_31_STABLE, MOODLE_35_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE, MOODLE_402_STABLE
    • MDL-41924_main
    • Difficult
    • Hide

      1. Create 2 courses, "Course1" and "Course2"
      2. On Course1, create a quiz and a question bank on the course level.
      3. On Course2, create a question bank.
      4. Create a user, and enrol them as manager on both courses.
      5. In each of the quiz, Course1 question bank and Course2 question bank, create 2 question categories, with 2 questions in each.
      6. In the Course 2 question bank, create a third category "TagCategory". In this category, create 3 questions. On 2 of the questions, set a tag called "TestTag". Leave the third question untagged.
      7. Go to the Course1 quiz, go to the questions tab, and add the following to the quiz:

      • One question from the quiz.
      • One question from the Course1 question bank
      • One question from the Course2 question bank (from a category with no tagged questions)
      • A random question from the Course2 question bank, with the Category filter set to "TagCategory" and the Tags filter set to "TestTag". This should show the 2 tagged questions as possible options.

      8. Within the quiz, select "More > Backup" and create a backup of just the quiz activity. Leave all the options as default.
      9. Download the backup, extract it (you may need to rename it to .tar.gz) and open the questions.xml file in a text editor.
      10. Confirm the questions.xml file contains the following (use CTRL+F and type the question/category name to search for them):

      • Both categories belonging to the quiz, and all 4 questions from those categories.
      • The category from the Course1 question bank containing the used question, and just that question.
      • The category from the Course2 question bank containing the used question, and just that question.
      • The catgory from the Course2 question bank containing the tagged questions, the two questions with tags, but not the one without.
      • Before fix: questions.xml contains all categories and questions.

      11. Go to "Course1 > More > Course Reuse > Backup" and create a backup of the whole course. Leave all the options as default.
      12. Download the backup, extract it (you may need to rename it to .tar.gz) and open the questions.xml file in a text editor.
      13. Confirm the questions.xml file contains the following (use CTRL+F and type the question/category name to search for them):

      • Both categories belonging to the quiz, and all 4 questions from those categories.
      • Both categories belonging to the Course1 question bank, and all 4 questions from those categories.
      • The category from the Course2 question bank containing the used question, and just that question.
      • The catgory from the Course2 question bank containing the tagged questions, the two questions with tags, but not the one without.
      • Before fix: questions.xml contains all categories and questions.
      Show
      1. Create 2 courses, "Course1" and "Course2" 2. On Course1, create a quiz and a question bank on the course level. 3. On Course2, create a question bank. 4. Create a user, and enrol them as manager on both courses. 5. In each of the quiz, Course1 question bank and Course2 question bank, create 2 question categories, with 2 questions in each. 6. In the Course 2 question bank, create a third category "TagCategory". In this category, create 3 questions. On 2 of the questions, set a tag called "TestTag". Leave the third question untagged. 7. Go to the Course1 quiz, go to the questions tab, and add the following to the quiz: One question from the quiz. One question from the Course1 question bank One question from the Course2 question bank (from a category with no tagged questions) A random question from the Course2 question bank, with the Category filter set to "TagCategory" and the Tags filter set to "TestTag". This should show the 2 tagged questions as possible options. 8. Within the quiz, select "More > Backup" and create a backup of just the quiz activity. Leave all the options as default. 9. Download the backup, extract it (you may need to rename it to .tar.gz) and open the questions.xml file in a text editor. 10. Confirm the questions.xml file contains the following (use CTRL+F and type the question/category name to search for them): Both categories belonging to the quiz, and all 4 questions from those categories. The category from the Course1 question bank containing the used question, and just that question. The category from the Course2 question bank containing the used question, and just that question. The catgory from the Course2 question bank containing the tagged questions, the two questions with tags, but not the one without. Before fix : questions.xml contains all categories and questions. 11. Go to "Course1 > More > Course Reuse > Backup" and create a backup of the whole course. Leave all the options as default. 12. Download the backup, extract it (you may need to rename it to .tar.gz) and open the questions.xml file in a text editor. 13. Confirm the questions.xml file contains the following (use CTRL+F and type the question/category name to search for them): Both categories belonging to the quiz, and all 4 questions from those categories. Both categories belonging to the Course1 question bank, and all 4 questions from those categories. The category from the Course2 question bank containing the used question, and just that question. The catgory from the Course2 question bank containing the tagged questions, the two questions with tags, but not the one without. Before fix : questions.xml contains all categories and questions.
    • Hide

      Code verified against automated checks.

      Checked MDL-41924 using repository: https://github.com/marxjohnson/moodle.git

      More information about this report

      Built on: Fri May 23 10:06:34 UTC 2025

      Show
      Code verified against automated checks. Checked MDL-41924 using repository: https://github.com/marxjohnson/moodle.git main (0 errors / 0 warnings) [branch: MDL-41924_main | CI Job ] More information about this report Built on: Fri May 23 10:06:34 UTC 2025
    • Show
      Launching automatic jobs for branch MDL-41924 _main https://ci.moodle.org/view/Testing/job/DEV.02%20-%20Developer-requested%20PHPUnit/18878/ PHPUnit (sqlsrv) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/64555/ Behat (NonJS - boost and classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/64556/ Behat (Firefox - boost) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/64557/ Behat (Firefox - classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/64558/ App tests (stable app version) Built on: Fri Mar 28 08:30:18 UTC 2025

      In MDL-12403 we addressed the ability to exclude the question bank entirely from backups. But people would also like it so that the entire question category is not included if a quiz uses a question from that category.

      For example, in the following hierarcy, all questions will be backed up:

      • System Question - IN QUIZ
      • System Question - NOT IN QUIZ
        • Course Cat Question - IN QUIZ
        • Course Cat Question - NOT IN QUIZ
          • Course Question - IN QUIZ
          • Course Question - NOT IN QUIZ
            • Quiz Question - IN QUIZ

      Ideally, only the ones in the quiz would be backed up. However, this is very tricky problem, because there can be cases like random questions where it can be any question from a category.

            Created:
            Updated:

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

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