The number of random questions required is more than are still available in the category!

The number of random questions required is more than are still available in the category!

by Abigail Barzilai -
Number of replies: 11
Hi,

We migrate to 1.9. from 1.5.3 . In the previous version I had no problem with the Random question. I tried to use the quiz from the previous version and I get
"The number of random questions required is more than are still available in the category!" attached is a screen shot. Can anyone Help?

Thanks,
Abigail
Attachment quizrandom.GIF
Average of ratings: -
In reply to Abigail Barzilai

Re: The number of random questions required is more than are still available in the category!

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I think we need more information to be able to help.

Can you tell us about the hierarchy of question categories that were used by this quiz before the upgrade (what the categories were, what the tree structure was, and how many questions in each category, and which category each question in the quiz picked form.)

And then can you look at what the hierarchy is like after the upgrade.
In reply to Tim Hunt

Re: The number of random questions required is more than are still available in the category!

by Abigail Barzilai -

Hi,

Thanks for your answer. I attached some screen shots regarding your question.

Thanks in advance,

Abigail

In reply to Abigail Barzilai

Re: The number of random questions required is more than are still available in the category!

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Very strange. It all looks like it should be working. The only slight potential for confusion is that you have different categories sharing the same name (both before and after the upgrade). It might be worth checking that the random questions in the quiz are really picking from the categories that you think they are.
In reply to Tim Hunt

Re: The number of random questions required is more than are still available in the category!

by Abigail Barzilai -
Is it possible that there is a connection between no of question in each category and the no of students in the course?
The other thing I have noticed is that the category that is working was the first category in the previous version.

Thanks,
Abigail
In reply to Abigail Barzilai

Re: The number of random questions required is more than are still available in the category!

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
No. Each student has the random questions picked independantly.
In reply to Tim Hunt

Re: The number of random questions required is more than are still available in the category!

by Chris Potter -
Unfortunately, we're having a similar issue. I've only seen it once, but it seemed quite impossible to me that it's happening (or why at least). We're pulling 20 questions (all multiple choice and true false) from a pool of 162 questions. I'm running 1.8+ and would be interested in knowing at least how this might have occurred. Any thoughts?
In reply to Chris Potter

Re: The number of random questions required is more than are still available in the category!

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I still don't understand how this can be happening, and have never seen it myself. I needs someone to poke around in the database and work out exactly what is going on.

The relevant code is in random_qtype::create_session_and_responses, which gets called when a quiz attempt is started like this: attempt.php -> get_question_states in lib/questionlib.php -> In a loop over questions, $QTYPES[$questions[$i]->qtype]->create_session_and_responses.

Someone who can reproduce the problem on a testing server needs to start putting some debugging code in there (Probably some pring_object($someinterestinglookingvariable) calls) and try to work out exactly what is going wrong.
In reply to Tim Hunt

Re: The number of random questions required is more than are still available in the category!

by Genner Cerna -
this happens only to essay question... a fix is available in the forum and hope this will be included in the stable release.
In reply to Genner Cerna

Re: The number of random questions required is more than are still available in the category!

by Chris Potter -
It's happened to us and we have no essay questions in the category we're pulling from... and we're pulling 20 in a pool of 56 questions. sad
In reply to Abigail Barzilai

Re: The number of random questions required is more than are still available in the category!

by David Wong -
We're getting the same bug error when we randomly select Essay type only questions. This must be tied to Essay question type given the earlier responses here.

"The number of random questions required is more than are still available in the category!"

I also turned on fully php debugging and NO errors were reported.

In reply to David Wong

Re: The number of random questions required is more than are still available in the category!

by Jaime Villate -
If I remember correctly,
you are getting that message because you have zero questions to choose from: essay questions are not counted, because they have a property defined that tells Moodle not to count them as candidates for random questions. Namely, Moodle does not allow essay questions to be chosen randomly.

I was also puzzled when I first got that message, and it took me a while to figure out what was going on.