46 if(count($composite->nodes) > 0)
48 $composite->nodes[0] = $this->
evaluate($composite->nodes[0]);
49 $composite->nodes[1] = $this->
evaluate($composite->nodes[1]);
50 $composite = $this->evaluateSubTree($composite);
66 $question = $this->object_loader->getQuestion($composite->nodes[0]->getQuestionIndex());
67 $rightNode = $composite->nodes[1];
71 $solutions = $question->getUserQuestionResult($this->activeId,$this->pass);
80 $result = $solutions->getSolutionForKey($index);
81 $gap = $question->getAvailableAnswerOptions($index-1);
85 if($gap->getType() == 1)
87 $answer = $gap->getItem(
$result[
'value'] - 1);
88 $solutions->removeByKey($index);
89 $solutions->addKeyValue($index, $answer->getAnswertext());
99 $answers = $gap->getItems();
101 foreach($answers as $answer)
103 if($max_points < $answer->getPoints())
105 $max_points = $answer->getPoints();
110 $reached_points = null;
112 switch($gap->getType())
115 for($order = 0; $order < $gap->getItemCount(); $order++)
117 $answer = $gap->getItem($order);
118 $item_points = $question->getTextgapPoints($answer->getAnswertext(),
$result[
'value'], $answer->getPoints());
119 if($item_points > $reached_points) $reached_points = $item_points;
124 for($order = 0; $order < $gap->getItemCount(); $order++)
126 $answer = $gap->getItem($order);
127 $item_points = $question->getNumericgapPoints($answer->getAnswertext(),
$result[
"value"], $answer->getPoints(), $answer->getLowerBound(), $answer->getUpperBound());
128 if($item_points > $reached_points) $reached_points = $item_points;
135 $answer = $gap->getItem(
$result[
'value'] - 1);
136 $reached_points = $answer->getPoints();
142 if($max_points != 0 && $reached_points !== null)
144 $percentage = (int)(($reached_points / $max_points) * 100);
146 $solutions->setReachedPercentage($percentage);
157 $result = $solutions->getSolutionForKey($index);
158 $answer = $question->getAvailableAnswerOptions($index-1);
160 $unit = $solutions->getSolutionForKey($index .
"_unit");
164 $key = $unit[
'value'];
167 $max_points = $answer->getPoints();
168 $points = $answer->getReachedPoints($question->getVariables(), $question->getResults(),
$result[
"value"], $key, $question->getUnitrepository()->getUnits());
173 $percentage = (int)(($points/$max_points)*100);
175 $solutions->setReachedPercentage($percentage);
178 $result = $rightNode->checkResult($solutions,$composite->getPattern(),$index);
182 switch($composite->getPattern())
185 $result = $composite->nodes[0] && $composite->nodes[1];
188 $result = $composite->nodes[0] || $composite->nodes[1];
195 if($composite->isNegated())
Class ResultOfAnswerOfCurrentQuestion for the expression R[m].
Class CompositeEvaluator.
Class ResultOfAnswerOfQuestion for the expression Qn[m].
const CLOZE_TEXT
Cloze question constants.
Class StringResultExpression for the expression ~TEXT~.
__construct($object_loader, $activeId, $pass)
evaluate(ilAssLacAbstractComposite $composite)
Class PercentageResultExpression for the expression n%.
Class ExpressionInterface.
isInstanceOfAnswerIndexProvidingExpression(ilAssLacAbstractComposite $composite)