From 078cc3f0441dbaeebf3fbbfd2cf5e8f709877c6d Mon Sep 17 00:00:00 2001 From: pichetp Date: Thu, 18 Sep 2008 06:13:18 +0000 Subject: [PATCH] MDL-16427 implement the '*' convention as for other questiontypes --- question/type/calculated/questiontype.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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.';'); } -- 2.39.5