47 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 $gap = $question->getAvailableAnswerOptions(
$index - 1);
83 if ($gap->getType() == 1) {
84 $answer = $gap->getItem(
$result[
'value'] - 1);
85 $solutions->removeByKey(
$index);
86 $solutions->addKeyValue(
$index, $answer->getAnswertext());
94 $answers = $gap->getItems();
96 foreach ($answers as $answer) {
97 if ($max_points < $answer->getPoints()) {
98 $max_points = $answer->getPoints();
103 $reached_points = null;
105 switch ($gap->getType()) {
107 for ($order = 0; $order < $gap->getItemCount(); $order++) {
108 $answer = $gap->getItem($order);
109 $item_points = $question->getTextgapPoints($answer->getAnswertext(),
$result[
'value'], $answer->getPoints());
110 if ($item_points > $reached_points) {
111 $reached_points = $item_points;
117 for ($order = 0; $order < $gap->getItemCount(); $order++) {
118 $answer = $gap->getItem($order);
119 $item_points = $question->getNumericgapPoints($answer->getAnswertext(),
$result[
"value"], $answer->getPoints(), $answer->getLowerBound(), $answer->getUpperBound());
120 if ($item_points > $reached_points) {
121 $reached_points = $item_points;
127 if (
$result[
'value'] != null) {
128 $answer = $gap->getItem(
$result[
'value'] - 1);
129 $reached_points = $answer->getPoints();
135 if ($max_points != 0 && $reached_points !== null) {
136 $percentage = (int) (($reached_points / $max_points) * 100);
138 $solutions->setReachedPercentage($percentage);
149 $answer = $question->getAvailableAnswerOptions(
$index - 1);
151 $unit = $solutions->getSolutionForKey(
$index .
"_unit");
153 if (is_array($unit)) {
154 $key = $unit[
'value'];
157 $max_points = $answer->getPoints();
158 $points = $answer->getReachedPoints($question->getVariables(), $question->getResults(),
$result[
"value"],
$key, $question->getUnitrepository()->getUnits());
161 if ($max_points != 0) {
162 $percentage = (int) (($points / $max_points) * 100);
164 $solutions->setReachedPercentage($percentage);
167 $result = $rightNode->checkResult($solutions, $composite->getPattern(),
$index);
169 switch ($composite->getPattern()) {
171 $result = $composite->nodes[0] && $composite->nodes[1];
174 $result = $composite->nodes[0] || $composite->nodes[1];
181 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)