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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Trivial Trivial
    • 1.9.4
    • 1.9.3
    • Quiz
    • None
    • CENT OS 5, PHP 5.1.6

      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));

            timhunt Tim Hunt
            nateh Nate H (Inactive)
            Sam Hemelryk Sam Hemelryk
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.