Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-34212

Cannot continue Quiz - get "No questions found" error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.3
    • Fix Version/s: None
    • Component/s: Quiz
    • Labels:
    • Affected Branches:
      MOODLE_23_STABLE

      Description

      Sometimes, when a user goes to resume their quiz attempt, they get a page saying "No questions found". The problem is that the url they get redirected to ( http://mymoodle.com/mod/quiz/attempt.php?attempt=564&page=28 ) has a non-existent page number. I've no idea where the 28 came from – there's only 3 pages in the quiz (10 questions each).

      We've only seen this since moving from 2.2 to 2.3.

      I haven't managed to make the problem recur, but have seen 3 independent instances of the issue.

      I've put in a rather hacky fix in mod/quiz/attemptlib.php::get_slots() so that if it can't find the quiz page, it shows all, but the real fix should find where the incorrect page number comes from.

      public function get_slots($page = 'all') {
      //Hacky fix added by Mark to prevent noquesitonsfound error with non-existent page #s
      if ($page !== 'all') {
      if(!array_key_exists($page, $this->pagelayout))

      { $page='all'; }

      }

      if ($page === 'all') {
      $numbers = array();
      foreach ($this->pagelayout as $numbersonpage)

      { $numbers = array_merge($numbers, $numbersonpage); }

      return $numbers;
      } else

      { return $this->pagelayout[$page]; }

      }

      Refs:
      http://moodle.org/mod/forum/discuss.php?d=206271
      http://moodle.org/mod/forum/discuss.php?d=206272

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                timhunt Tim Hunt
                Reporter:
                mwebster Mark van Hoek
                Participants:
                Component watchers:
                Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              • Votes:
                4 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: