-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
4.4.1, 4.4.3, 4.5.3
-
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
- 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').
- Add enough questions to question category 'A' so that we have more than 3 pages of questions.
- Add enough questions to question category 'B' so that we have a lesser number of pages than question category 'A'.
- 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.
- Now select Question category 'A' from the question bank filter dropdown and navigate to the 4th page.
- 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.