diff --git a/questiontype.php b/questiontype.php index 34a6af73efd7bddaa71b07caa8cd40c8e398222e..57e2658254e9f3ab79722800a96a23e59cfa51f4 100644 --- a/questiontype.php +++ b/questiontype.php @@ -1085,13 +1085,16 @@ class qtype_stack extends question_type { foreach ($q->prts as $index => $prt) { foreach ($prt->get_nodes_summary() as $nodeid => $choices) { - $parts[$index . '-' . $nodeid] = array( - $choices->falseanswernote => new question_possible_response( - $choices->falseanswernote, $choices->falsescore * $prt->get_value()), - $choices->trueanswernote => new question_possible_response( - $choices->trueanswernote, $choices->truescore * $prt->get_value()), - null => question_possible_response::no_response(), - ); + // STACK allows variables in scores, which may not be evaluated. + if (is_numeric($choices->falsescore) && is_numeric($choices->truescore)) { + $parts[$index . '-' . $nodeid] = array( + $choices->falseanswernote => new question_possible_response( + $choices->falseanswernote, $choices->falsescore * $prt->get_value()), + $choices->trueanswernote => new question_possible_response( + $choices->trueanswernote, $choices->truescore * $prt->get_value()), + null => question_possible_response::no_response(), + ); + } } }