]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-16427 implement the '*' convention as for other questiontypes
authorpichetp <pichetp>
Thu, 18 Sep 2008 06:13:18 +0000 (06:13 +0000)
committerpichetp <pichetp>
Thu, 18 Sep 2008 06:13:18 +0000 (06:13 +0000)
question/type/calculated/questiontype.php

index 34b781539ebc1b5429636fd99f1f3040c1eabfdf..bc1078241192391124fc20cd04cdac36f83d8593 100644 (file)
@@ -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".'<br/><br/>';
@@ -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.';');
         }