-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
4.1.15, 4.4.4, 4.5
-
MOODLE_401_STABLE, MOODLE_404_STABLE, MOODLE_405_STABLE
There is a couple of problems with random questions and question categories in mod_quiz.
The first problem
When you attempt the quiz you get this error message
There are not enough questions in category 1 to create the question Random question (1).
More information about this error (https://docs.moodle.org/405/en/error/quiz/notenoughrandomquestions)
Debug info:
Error code: notenoughrandomquestions
Stack trace:
- line 241 of /mod/quiz/locallib.php: core\exception\moodle_exception thrown
- line 2060 of /mod/quiz/locallib.php: call to quiz_start_new_attempt()
- line 110 of /mod/quiz/startattempt.php: call to quiz_prepare_and_start_new_attempt()
Desired behaviour
- Only categories that potentially can contain questions should be offered as random question categories or the random question should link to all the questions and categories within the chosen category even if the category itself cannot contain questions (like top categories).
- The random question shows and uses the category set, not another category.
- No errors occur.
Steps
- Create a quiz.
- Create a couple of questions in Default for the quiz category.
- Create a couple of random questions in the quiz. Choose the Top for the quiz category.
- See the category is not what you chose when you created random questions.
- You may also set the category to Top for the quiz again. In random question it may show the top category but in the questions interface in the quiz there the system shows another category.
- Try to preview or attempt the quiz.
If you duplicate the quiz the copy has the problem as well.
The second problem is here https://tracker.moodle.org/browse/MDL-83597 and I think it's related.