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

Question Bank throws syntax error when filtering by question categories that have varying number of pages of questions.

XMLWordPrintable

    • MOODLE_404_STABLE, MOODLE_405_STABLE

      Raising this issue after reviewing MoodleCloud support request : MC-7895

      Bug could potentially be a regression of MDL-72321

      Steps to reproduce 

      1. Create two question categories in the question bank (for ease of understanding, let us refer to them as question category 'A' and question category 'B').
      2. Add enough questions to question category 'A' so that we have more than 3 pages of questions.
      3. Add enough questions to question category 'B' so that we have a lesser number of pages than question category 'A'.
      4. For ease of understanding, let us consider that that question category 'A' has 4 pages of questions and question category 'B' has two pages of questions. 
      5. Now select Question category 'A' from the question bank filter dropdown and navigate to the 4th page.
      6. While in the 4th page, select question category 'B' from the filter dropdown. This should throw the syntax error.

      Expected result: Paginator should reset to the 1st page and questions of the newly selected question category should load successfully.

      Actual result: Syntax error popup

      I noticed that upon filtering by the question category the 'qpage' parameter sent in the request remains at the current page number (In other words, the paginator  wont reset to the 1st page upon selecting a new question category from the filter dropdown). 

      Furthermore, when previewing the response for the ajax call in Chrome DevTools during the error, a more informative error message appears at the end of the response. 

      {"error":true,"exception":{"message":"Coding error detected, it must be fixed by a programmer: moodle_database::get_in_or_equal() does not accept empty arrays","errorcode":"codingerror","link":"https:\/\/garifunafns.moodlecloud.com\/question\/edit.php?courseid=8&filter=%7B%22category%22%3A%7B%22name%22%3A%22category%22%2C%22jointype%22%3A1%2C%22values%22%3A%5B877%5D%2C%22filteroptions%22%3A%5B%7B%22name%22%3A%22includesubcategories%22%2C%22value%22%3Atrue%7D%5D%7D%2C%22hidden%22%3A%7B%22name%22%3A%22hidden%22%2C%22jointype%22%3A1%2C%22values%22%3A%5B0%5D%2C%22filteroptions%22%3A%5B%5D%7D%2C%22jointype%22%3A2%7D","moreinfourl":"http:\/\/docs.moodle.org\/404\/en\/error\/debug\/codingerror"} 

      This error is generated from the get_all_places_where_questions_were_attempted() function in the statistics_bulk_loader.php file 

      A screen recording of the workflow leading to the error is attached on the issue.

      Workaround : The workaround would be to navigate to always the 1st page of a question category before selecting a new question category from the filter dropdown.

      Willing to provide more information, if needed, for anyone working on the issue. 

        1. Screenshot 2024-09-06 at 12.54.47 PM.png
          330 kB
          Dhanuka Waidyatillake
        2. sreen_record_1.mp4
          1.67 MB
          Dhanuka Waidyatillake

            Unassigned Unassigned
            dhanuka.waidyatillake@moodle.com Dhanuka Waidyatillake
            Votes:
            2 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:

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