From 175462491693534dfc8bfa94549f3537611da798 Mon Sep 17 00:00:00 2001 From: kaipe Date: Sun, 10 Aug 2003 12:09:49 +0000 Subject: [PATCH] Fixed bug that was pointed out by Tom Cat: The reuse of old quiz_answers records for question type multianswer/embedded did not work properly. --- mod/quiz/lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index 0f07c75f95..27628e265a 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -2255,8 +2255,8 @@ function quiz_save_multianswer_alternatives // otherwise the ids of the answers. if (empty($oldalternativeids) - or $oldalternatives = - get_records_list('quiz_answers', 'id', $oldalternativeids)) + or !($oldalternatives = + get_records_list('quiz_answers', 'id', $oldalternativeids))) { $oldalternatives = array(); } @@ -2280,7 +2280,7 @@ function quiz_save_multianswer_alternatives $alt->answer = $altdata->answer; $alt->fraction = $altdata->fraction; $alt->feedback = $altdata->feedback; - if (! $alt->id = insert_record("quiz_answers", $alt)) { + if (!($alt->id = insert_record("quiz_answers", $alt))) { return false; } } @@ -2319,7 +2319,7 @@ function quiz_save_multianswer_alternatives delete_records("quiz_answers", "id", $altobsolete->id); // Possibly obsolute numerical options are also to be deleted: - delete_records("quiz_numerical", 'answer', $alt->id); + delete_records("quiz_numerical", 'answer', $altobsolete->id); } // Common alternative options and removal of obsolete options -- 2.39.5