diff --git a/components/ILIAS/Test/classes/Evaluation/class.ilTestEvaluationFactory.php b/components/ILIAS/Test/classes/Evaluation/class.ilTestEvaluationFactory.php index 0c2c4423aad6..1998fb918b28 100644 --- a/components/ILIAS/Test/classes/Evaluation/class.ilTestEvaluationFactory.php +++ b/components/ILIAS/Test/classes/Evaluation/class.ilTestEvaluationFactory.php @@ -306,22 +306,27 @@ private function addMarksToParticipants(ilTestEvaluationData $evaluation_data): foreach ($evaluation_data->getParticipantIds() as $active_id) { $user_eval_data = $evaluation_data->getParticipant($active_id); - $percentage = $user_eval_data->getReachedPointsInPercent(); - $mark = $mark_schema->getMatchingMark($percentage); - - if ($mark !== null) { - $user_eval_data->setMark($mark); - for ($i = 0;$i < $user_eval_data->getPassCount();$i++) { - $pass_data = $user_eval_data->getPass($i); - $mark = $mark_schema->getMatchingMark( - $pass_data->getReachedPointsInPercent() - ); - if ($mark !== null) { - $pass_data->setMark($mark); - } - } + $mark = $mark_schema->getMatchingMark( + $user_eval_data->getReachedPointsInPercent() + ); + + if ($mark === null) { + continue; } + $user_eval_data->setMark($mark); + for ($i = 0; $i < $user_eval_data->getPassCount(); $i++) { + $pass_data = $user_eval_data->getPass($i); + if ($pass_data === null) { + continue; + } + $mark = $mark_schema->getMatchingMark( + $pass_data->getReachedPointsInPercent() + ); + if ($mark !== null) { + $pass_data->setMark($mark); + } + } } return $evaluation_data;