From d629afa0e2d4bdf9ec466c1b513166b620ecc8c3 Mon Sep 17 00:00:00 2001 From: Adam Olley Date: Fri, 12 Sep 2014 16:26:14 +0930 Subject: [PATCH] MDL-47224 qtype_calculated: Calculated qtype comment on datasetitems should follow formatting rules --- question/type/calculated/questiontype.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/question/type/calculated/questiontype.php b/question/type/calculated/questiontype.php index aa305d7445c..5c91e4c212b 100644 --- a/question/type/calculated/questiontype.php +++ b/question/type/calculated/questiontype.php @@ -1082,6 +1082,17 @@ class qtype_calculated extends question_type { $ans = new qtype_numerical_answer(0, $ansvalue, 0, '', 0, $answer->tolerance); $ans->tolerancetype = $answer->tolerancetype; list($answer->min, $answer->max) = $ans->get_tolerance_interval($answer); + + $formattedmin = qtype_calculated_calculate_answer( + $answer->min, $data, $answer->tolerance, + $answer->tolerancetype, $answer->correctanswerlength, + $answer->correctanswerformat, $unit); + $answer->min = $formattedmin->answer; + $formattedmax = qtype_calculated_calculate_answer( + $answer->max, $data, $answer->tolerance, + $answer->tolerancetype, $answer->correctanswerlength, + $answer->correctanswerformat, $unit); + $answer->max = $formattedmax->answer; } if ($answer->min === '') { // This should mean that something is wrong.