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

populate_question_sources in mod_quiz\structure loads data for every question_category in the system

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 5.0
    • Questions
    • MOODLE_500_STABLE
    • MDL-85200_500_STABLE
    • MDL-85200_main
    • Hide

      This is covered by behat in mod/quiz/tests/behat/editing_add_from_question_bank.feature

      Manual steps:
      1. Create a course "C1"
      2. Go to course "C1", navigate to More > Question banks
      3. Create the default question bank for the course, which should be called "C1 shared question bank"
      4. Click "Create a new question". Add a True/False question called "TF1"
      5. Return to the course page
      6. Add a new quiz to the course.
      7. Go to the Questions tab
      8. Click "Add" > "from question bank"
      9. In the modal, click "Switch bank" and select "C1 shared question bank".
      10. Check the checkbox next to "TF1" and select "Add selected questions to quiz"

      • Confirm that the question is displayed on the Questions page, with "C1 shared question bank" in a blue pill next to it.
      Show
      This is covered by behat in mod/quiz/tests/behat/editing_add_from_question_bank.feature Manual steps: 1. Create a course "C1" 2. Go to course "C1", navigate to More > Question banks 3. Create the default question bank for the course, which should be called "C1 shared question bank" 4. Click "Create a new question". Add a True/False question called "TF1" 5. Return to the course page 6. Add a new quiz to the course. 7. Go to the Questions tab 8. Click "Add" > "from question bank" 9. In the modal, click "Switch bank" and select "C1 shared question bank". 10. Check the checkbox next to "TF1" and select "Add selected questions to quiz" Confirm that the question is displayed on the Questions page, with "C1 shared question bank" in a blue pill next to it.
    • Hide

      Code verified against automated checks.

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

      More information about this report

      Built on: Wed Jun 4 09:47:24 UTC 2025

      Show
      Code verified against automated checks. Checked MDL-85200 using repository: https://github.com/marxjohnson/moodle.git MOODLE_500_STABLE (0 errors / 0 warnings) [branch: MDL-85200_500_STABLE | CI Job ] main (0 errors / 0 warnings) [branch: MDL-85200_main | CI Job ] More information about this report Built on: Wed Jun 4 09:47:24 UTC 2025

      This code needs to be improved: https://github.com/moodle/moodle/blob/2499276c6588973187edd115b955cd008682423e/mod/quiz/classes/structure.php#L1865

      1. The SQL is really abusing GROUP BY to get distinct rows from an inefficient query with many repeated rows.
      2. It gets data for every module with questions in the whole system, not just the ones used in this quiz, which is hugely inefficient.

            marxjohnson Mark Johnson
            timhunt Tim Hunt
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:

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