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