Skip to content

Commit

Permalink
T&A Fix has Participant::hasAnsweredQuestionsForScoredAttempt call un…
Browse files Browse the repository at this point in the history
…defined method.

This PR addresses https://mantis.ilias.de/view.php?id=42760.

During a recent refactoring, a new method was introduced to check for scored attempts.
However, it appears that a typo occurred in the implementation. Specifically, instead of calling `getAttemptOverviewInformation` to verify if the reference exists,
 the code mistakenly used `hasAttemptOverviewInformation`.

To resolve this, I refactored the code to use the null-coalescing operator, ensuring the proper method is utilized and the reference is correctly checked.
  • Loading branch information
thojou authored and kergomard committed Nov 15, 2024
1 parent bb41200 commit 8463e1f
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions components/ILIAS/Test/src/Participants/Participant.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,7 @@ public function getLastAccess(): ?\DateTimeImmutable

public function hasAnsweredQuestionsForScoredAttempt(): bool
{
if (!$this->hasAttemptOverviewInformation()) {
return false;
}

return $this->attempt_overview->hasAnsweredQuestions();
return $this->attempt_overview?->hasAnsweredQuestions() ?? false;
}

public function getRemainingDuration(
Expand Down

0 comments on commit 8463e1f

Please sign in to comment.