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

Quiz add from question bank: paging has inconsistent behavior when changing categories

XMLWordPrintable

      Assumptions:

      • Question bank has at least two categories with more than 20 questions each
      • Moodle 4.3.6 or 4.4 (on the current sandbox site)

      Steps to reproduce:

      • (optional) Use the attached question bank backup with 2 categories with 40 questions each: Question Bank Test Questions-20240813-0819.xml
      • See attached video (taken from the current sandbox.moodledemo.net after importing questions) Add Question from Question Bank Paging Bug.mp4
      • Create a new quiz
      • select "questions"
      • Use browser dev tools to inspect the page and the network traffic, paying particular attention to the Fetch/XHR traffic for the AJAX calls
      • Click on "Add" -> "from question bank"
      • (a pop up window with title "Add from the question bank at the end" dialog opens)
      • Drop-down select a category with more than 20 questions (Test Questions Category 1 in the video example)
      • Click on "Apply filters"
        • Notice in the network tab on the browser there is a single call to /lib/ajax/service.php?sesskey=xxxx&info=core_get_fragment
        • (the first page of the first 20 questions appears)
      • Click on "2" to navigate to the second page
        • Notice in the network tab on the browser there are 2 calls to /lib/ajax/service.php?sesskey=xxxx&info=core_get_fragment
      • Click on "1" to navigate back to the first page
        • Notice in the network tab on the browser there are 3 calls to /lib/ajax/service.php?sesskey=xxxx&info=core_get_fragment
        • In my video example, the category also switches back to the default category and no questions are in that category on the sandbox site.
      • Change the category filter to another category with more than 20 questions (Test Questions Category 2 in the video example)
      • Click on "Apply filters"
        • Notice in the network tab on the browser there is a single call to /lib/ajax/service.php?sesskey=xxxx&info=core_get_fragment
        • (the first page of the first 20 questions in the selected category appears)
      • Click on "2" to navigate to the second page
        • Notice in the network tab on the browser there are 4 calls to /lib/ajax/service.php?sesskey=xxxx&info=core_get_fragment
        • Also a flash of the questions
      • Click on "1" to navigate back to the first page
        • Notice in the network tab on the browser there are 5 calls to /lib/ajax/service.php?sesskey=xxxx&info=core_get_fragment
        • In my video example, the Test Questions Category 1 questions flash, then disappear as the category switches back to the default category

      Observations:

      • When inspecting the page and the "click" event listeners registered on the page numbers, every time a page number is clicked, there is a new "click" event registered to call first.js:2512 on every page link.  This seems to correspond to question/amd/src/filter.js line 183.  See attached screenshots of the registered event handlers.

       

        1. Add Question from Question Bank Paging Bug.mp4
          1.76 MB
          Mike Gerszewski
        2. Change pages 3rd click.png
          6 kB
          Mike Gerszewski
        3. Change pages 4th click.png
          7 kB
          Mike Gerszewski
        4. new_recording_-_9_15_2024,_11_29_25_am (Original).mp4
          2.42 MB
          Mike Howell
        5. Question Bank Test Questions-20240813-0819.xml
          131 kB
          Mike Gerszewski

            Votes:
            65 Vote for this issue
            Watchers:
            45 Start watching this issue

              Created:
              Updated:
              Resolved:

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