]> git.mjollnir.org Git - moodle.git/commitdiff
Make a library function for deleting quiz attempts, rather than having duplicated...
authortjhunt <tjhunt>
Sat, 23 Jun 2007 10:39:28 +0000 (10:39 +0000)
committertjhunt <tjhunt>
Sat, 23 Jun 2007 10:39:28 +0000 (10:39 +0000)
mod/quiz/attempt.php

index 5139fa0ff314bffab86405f28310cfb8cf7d87fc..c298c4f5bc8ce52b114f80e7f7b81763229b6b88 100644 (file)
     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);
             }