From: kaipe Date: Sun, 10 Aug 2003 12:09:49 +0000 (+0000) Subject: Fixed bug that was pointed out by Tom Cat: X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=175462491693534dfc8bfa94549f3537611da798;p=moodle.git 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. --- 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