MDL-63870 quiz: new preview should abandon, not finish, current attempt

This commit is contained in:
Tim Hunt
2019-01-17 17:55:39 +00:00
parent 7412ad6141
commit a7428f69ad
+2 -2
View File
@@ -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));
}