There are not enough questions in category XX to create the question Random

There are not enough questions in category XX to create the question Random

by Márcio Ferreira -
Number of replies: 1

Moodle allows to add unlimited Random Questions to a Quiz from any category I have. However, when attempting the quiz, the follow error is reported:

"There are not enough questions in category XX to create the question Random

Debug info:
Error code: notenoughrandomquestions
Stack trace:
line 198 of /mod/quiz/startattempt.php: moodle_exception thrown"

Seems to be obvious that a user should not be able to add more random questions than the total number of a category, since that there will not be duplicated questions in the quiz.

This is a known bug? Or.. how could I solve that?

I'm using Moodle 2.5.4

Average of ratings: -
In reply to Márcio Ferreira

Re: There are not enough questions in category XX to create the question Random

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

It is a known bug. MDL-6103. It is not obvious, because random questions may or may not select from subcategories of the given category.

If you have a complex hierarchy of categories, and a complex mixture of random questions from that hierarchy added to your quiz, it is almost impossible to pre-compute whether it is safe.

You will note that the interface makes a basic effort to stop you adding too many questions from a given category, but it does not make it impossible. After all, you might want to build the quiz first, then add the questions to the question bank later.

Average of ratings: Useful (1)