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

Quizzes always appear closed from teacher's perspective, regardless of "quiz closes" settings

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 1.9.3
    • Fix Version/s: 1.9.4
    • Component/s: Quiz
    • Labels:
      None
    • Environment:
      CENT OS 5, PHP 5.1.6

      Description

      To reproduce: Using the latest 1.9 build ( cvs -z3 -d:pserver:anonymous@eu.cvs.moodle.org:/cvsroot/moodle co -P -r MOODLE_19_STABLE moodle )

      1) Login as an instructor
      2) Create a course
      3) Create a new quiz, with no "close" date
      4) View the quiz
      Expected result: I expect the "preview quiz now" button to appear.
      Actual result: The message "This quiz closed on " appears, with the date of the UNIX epoch listed as the close date.

      5) Change the "close" date to sometime in the future
      6) View the quiz
      Expected result: I expect the "preview quiz now" button to appear, accompanied by the closing date of the quiz.
      Actual result: The message "This quiz closed on " appears, with the correct (future) closing date of the quiz.

      This appears to be a result of a code change to mod/quiz/view.php at line 108, which ANDs the quiz open/close times with the has_capability('mod/quiz:attempt'). This capability will (correctly) be missing for instructors, as they can only preview the quiz, not attempt it.

      My fix was to OR that capability has_capability('mod/quiz:manage') so lines 105-108 now appear as:
      // Print information about timings.
      $timenow = time();
      $available = ($quiz->timeopen < $timenow and ($timenow < $quiz->timeclose or !$quiz->timeclose)) &&
      (has_capability('mod/quiz:attempt', $context) || has_capability('mod/quiz:manage', $context));

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                timhunt Tim Hunt
                Reporter:
                nateh Nate H
                Tester:
                Sam Hemelryk
                Participants:
                Component watchers:
                Tim Hunt, Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  28/Jan/09