From bc2defd5f856729bf6d0d742bc16a8e28a81fdcd Mon Sep 17 00:00:00 2001 From: tjhunt Date: Fri, 18 Aug 2006 10:29:34 +0000 Subject: [PATCH] Bug #3481 - wildcard problem in cloze question. Thanks to Joseph Rezeau. Merged from MOODLE_16_STABLE, not a straight merge becuase of other 1.7 changes. --- question/type/multianswer/questiontype.php | 24 +++------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/question/type/multianswer/questiontype.php b/question/type/multianswer/questiontype.php index 0dd0396333..3b841fd004 100644 --- a/question/type/multianswer/questiontype.php +++ b/question/type/multianswer/questiontype.php @@ -234,32 +234,14 @@ class embedded_cloze_qtype extends default_questiontype { $chosenanswer = null; switch ($wrapped->qtype) { case 'numerical': - $testedstate = clone($state); - $testedstate->responses[''] = $response; - $raw_grade = 0; - foreach ($answers as $answer) { - if($QTYPES[$wrapped->qtype] - ->test_response($wrapped, $testedstate, $answer)) { - if (empty($raw_grade) || $raw_grade < $answer->fraction) { - $chosenanswer = clone($answer); - $raw_grade = $answer->fraction; - } - } - } - break; case 'shortanswer': $testedstate = clone($state); $testedstate->responses[''] = $response; - $teststate = clone($state); - $raw_grade = 0; foreach ($answers as $answer) { - $teststate->responses[''] = trim($answer->answer); if($QTYPES[$wrapped->qtype] - ->compare_responses($wrapped, $testedstate, $teststate)) { - if (empty($raw_grade) || $raw_grade < $answer->fraction) { - $chosenanswer = clone($answer); - $raw_grade = $answer->fraction; - } + ->test_response($wrapped, $testedstate, $answer)) { + $chosenanswer = clone($answer); + break; } } break; -- 2.39.5