From 93cf55eb72a1af589eef414cd3583f9460b0277f Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Fri, 31 May 2013 20:24:50 +0100 Subject: [PATCH] MDL-39971 each attempt builds on last broken for previews. --- mod/quiz/startattempt.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mod/quiz/startattempt.php b/mod/quiz/startattempt.php index f1f08ca91e4..4a47194b19a 100644 --- a/mod/quiz/startattempt.php +++ b/mod/quiz/startattempt.php @@ -93,7 +93,7 @@ if ($lastattempt && ($lastattempt->state == quiz_attempt::IN_PROGRESS || // And, if the attempt is now no longer in progress, redirect to the appropriate place. if ($lastattempt->state == quiz_attempt::OVERDUE) { - redirect($quizobj->summary_url($lastattempt->id)); + redirect($quizobj->summary_url($lastattempt->id)); } else if ($lastattempt->state != quiz_attempt::IN_PROGRESS) { redirect($quizobj->review_url($lastattempt->id)); } @@ -104,6 +104,10 @@ if ($lastattempt && ($lastattempt->state == quiz_attempt::IN_PROGRESS || } } else { + while ($lastattempt && $lastattempt->preview) { + $lastattempt = array_pop($attempts); + } + // Get number for the next or unfinished attempt. if ($lastattempt) { $attemptnumber = $lastattempt->attempt + 1;