Skip to content

Commit

Permalink
Test: Fix Access To Function on Null in Eval
Browse files Browse the repository at this point in the history
  • Loading branch information
kergomard committed Jan 3, 2025
1 parent d1c927f commit 511952b
Showing 1 changed file with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 511952b

Please sign in to comment.