Moodle
  1. Moodle
  2. MDL-26369

Quiz report overview throwing notices some times...

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.0.2
    • Component/s: Quiz
    • Labels:
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      To reproduce:

      • Create one quiz with time limit (timefinish).
      • As student, complete one attempt.
      • As admin, preview it, submit it partially (not finishing it)
      • Go to the Overview report. This notice is shown: "Undefined property: stdClass::$id in /mod/quiz/locallib.php on line 920"

      To fix:

       
      diff --git a/mod/quiz/locallib.php b/mod/quiz/locallib.php
      index e085c18..32b95ee 100644
      --- a/mod/quiz/locallib.php
      +++ b/mod/quiz/locallib.php
      @@ -916,7 +916,7 @@ function quiz_get_reviewoptions($quiz, $attempt, $context) {
           }
       
           // Show a link to the comment box only for closed attempts
      -    if ($attempt->timefinish && has_capability('mod/quiz:grade', $context)) {
      +    if (!empty($attempt->id) && $attempt->timefinish && has_capability('mod/quiz:grade', $context)) {
               $options->questioncommentlink = new moodle_url('/mod/quiz/comment.php', array('attempt' => $attempt->id));
           }

      Ciao

        Gliffy Diagrams

          Activity

          Hide
          Eloy Lafuente (stronk7) added a comment -

          I think we agreed about using stable backlogs and so on, correct?

          Also, what about using the "patch" label if there is solution provided?

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - I think we agreed about using stable backlogs and so on, correct? Also, what about using the "patch" label if there is solution provided? Ciao
          Hide
          Tim Hunt added a comment -

          This is a good fix. Will you do the pull request, or shall I?

          Show
          Tim Hunt added a comment - This is a good fix. Will you do the pull request, or shall I?
          Hide
          Tim Hunt added a comment -

          Thanks Eloy.

          Show
          Tim Hunt added a comment - Thanks Eloy.

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: