From: tjhunt Date: Sat, 23 Jun 2007 10:39:28 +0000 (+0000) Subject: Make a library function for deleting quiz attempts, rather than having duplicated... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=ccac7305eadd321c5dac5a84bcf7feca0d182695;p=moodle.git Make a library function for deleting quiz attempts, rather than having duplicated code - Followup: make sure we only delete preview attempts. Merged from OU Moodle. --- diff --git a/mod/quiz/attempt.php b/mod/quiz/attempt.php index 5139fa0ff3..c298c4f5bc 100644 --- a/mod/quiz/attempt.php +++ b/mod/quiz/attempt.php @@ -174,7 +174,7 @@ if (!$attempt) { // Delete any previous preview attempts belonging to this user. if ($oldattempts = get_records_select('quiz_attempts', "quiz = '$quiz->id' - AND userid = '$USER->id'")) { + AND userid = '$USER->id' AND preview = 1")) { foreach ($oldattempts as $oldattempt) { quiz_delete_attempt($oldattempt, $quiz); }