Skip to content

Commit 5c6c172

Browse files
committed
MDL-46148 qtype_calculatedsimple: fix notice
... when adding a dataset with a formula error.
1 parent 66de66f commit 5c6c172

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: question/type/calculated/questiontype.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -1061,10 +1061,14 @@ public function comment_on_datasetitems($qtypeobj, $questionid, $questiontext,
10611061
}
10621062

10631063
$answers = fullclone($answers);
1064-
$errors = '';
10651064
$delimiter = ': ';
10661065
$virtualqtype = $qtypeobj->get_virtual_qtype();
10671066
foreach ($answers as $key => $answer) {
1067+
$error = qtype_calculated_find_formula_errors($answer->answer);
1068+
if ($error) {
1069+
$comment->stranswers[$key] = $error;
1070+
continue;
1071+
}
10681072
$formula = $this->substitute_variables($answer->answer, $data);
10691073
$formattedanswer = qtype_calculated_calculate_answer(
10701074
$answer->answer, $data, $answer->tolerance,

0 commit comments

Comments
 (0)