From a7428f69add52e2e2a86bdfaad5f35ec60eb5fc8 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Fri, 11 Jan 2019 18:35:05 +0000 Subject: [PATCH] MDL-63870 quiz: new preview should abandon, not finish, current attempt --- mod/quiz/locallib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mod/quiz/locallib.php b/mod/quiz/locallib.php index 0c46d2728a4..f2848c8849a 100644 --- a/mod/quiz/locallib.php +++ b/mod/quiz/locallib.php @@ -2313,8 +2313,8 @@ function quiz_validate_new_attempt(quiz $quizobj, quiz_access_manager $accessman // Check to see if a new preview was requested. if ($quizobj->is_preview_user() && $forcenew) { // To force the creation of a new preview, we mark the current attempt (if any) - // as finished. It will then automatically be deleted below. - $DB->set_field('quiz_attempts', 'state', quiz_attempt::FINISHED, + // as abandoned. It will then automatically be deleted below. + $DB->set_field('quiz_attempts', 'state', quiz_attempt::ABANDONED, array('quiz' => $quizobj->get_quizid(), 'userid' => $USER->id)); }