No Question Found: 2.4 through 2.6 solution

No Question Found: 2.4 through 2.6 solution

by Logan Modine -
Number of replies: 3

Like many of you we've been encountering a 'No Questions Found' error when returning to a quiz in progress; a problem we first noticed in Moodle 2.4.4 and that has cropped up again in 2.6.

It appears the problem occurs when the quiz is multi-page, and Moodle directs a returning user to a quiz page number that doesn't exist.

For our purposes it made sense to simply send a user to the first page of the quiz and allow them to navigate to whichever page they want after that.

Our fix (for both moodle 2.4 and 2.6) involves a small edit to /mod/quiz/attempt.php, around line 98.

Simply replace:

// Check.
if (empty($slots)) {
throw new moodle_quiz_exception($attemptobj->get_quizobj(), 'noquestionsfound');
}

With:

// Check.
if (empty($slots)) {
$page = 1;
$slots = $attemptobj->get_slots($page);
}

Now you'll go to page 1 regardless of whether Moodle is incorrectly returning the number of pages in a quiz or not.  This problem has been driving our users crazy - I hope it helps others experiencing the same thing.

Average of ratings: -
In reply to Logan Modine

Re: No Question Found: 2.4 through 2.6 solution

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 thought this issue had been solved ages ago (MDL-34451 fixed in 2.3.2). I have never seen it in 2.6.

In reply to Tim Hunt

Re: No Question Found: 2.4 through 2.6 solution

by Logan Modine -

I thought so too based on what I'd seen on the tracker - we saw a bunch of it on 2.4.4 however, and recently on 2.6.  I'd say it was some odd file I'd carried over from an earlier version, but the 2.6 install was clean.  Does it make sense that something like this could be linked to a database?

In reply to Logan Modine

Re: No Question Found: 2.4 through 2.6 solution

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

Did you backup and restore quizzes with userdata from your old site into 2.6? That is the only way I could think of that bad data might get into 2.6. (But I might be missing something.)

Alternatively, can you find a way in 2.6, starting by creating a new coures and quiz, and ending up at the "No Question Found" error. If you can do that, then there is a reproducible bug, which should be easy to fix.