From: pichetp Date: Thu, 18 Sep 2008 06:13:18 +0000 (+0000) Subject: MDL-16427 implement the '*' convention as for other questiontypes X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=078cc3f0441dbaeebf3fbbfd2cf5e8f709877c6d;p=moodle.git MDL-16427 implement the '*' convention as for other questiontypes --- diff --git a/question/type/calculated/questiontype.php b/question/type/calculated/questiontype.php index 34b781539e..bc10782411 100644 --- a/question/type/calculated/questiontype.php +++ b/question/type/calculated/questiontype.php @@ -1041,8 +1041,12 @@ class question_calculated_qtype extends default_questiontype { $answer->answer, $data, $answer->tolerance, $answer->tolerancetype, $answer->correctanswerlength, $answer->correctanswerformat, $unit); - eval('$answer->answer = '.$formula.';') ; - $virtualqtype->get_tolerance_interval($answer); + if ( $formula === '*'){ + $answer->min = '' ; + }else { + eval('$answer->answer = '.$formula.';') ; + $virtualqtype->get_tolerance_interval($answer); + } if ($answer->min === '') { // This should mean that something is wrong $stranswers .= " -$formattedanswer->answer".'

'; @@ -1161,6 +1165,8 @@ class question_calculated_qtype extends default_questiontype { /// Calculate the correct answer if (empty($formula)) { $str = ''; + } else if ($formula === '*'){ + $str = '*'; } else { eval('$str = '.$formula.';'); }