diff --git a/components/ILIAS/Test/src/Participants/ParticipantTable.php b/components/ILIAS/Test/src/Participants/ParticipantTable.php index ff5ab5e4a9de..fa9ec5b417c5 100644 --- a/components/ILIAS/Test/src/Participants/ParticipantTable.php +++ b/components/ILIAS/Test/src/Participants/ParticipantTable.php @@ -112,7 +112,7 @@ public function getRows( 'login' => $record->getLogin(), 'matriculation' => $record->getMatriculation(), 'total_time_on_task' => $record->getAttemptOverviewInformation()?->getHumanReadableTotalTimeOnTask() ?? '', - 'status_of_attempt' => $this->lng->txt($status_of_attempt->value), + 'status_of_attempt' => $status_of_attempt->getTranslation($this->lng), 'id_of_attempt' => $record->getAttemptOverviewInformation()?->getExamId(), 'ip_range' => $record->getClientIpTo() !== '' || $record->getClientIpFrom() !== '' ? sprintf('%s - %s', $record->getClientIpFrom(), $record->getClientIpTo()) @@ -216,11 +216,13 @@ private function getPostLoadOrderFields(): array ) => $a->getRemainingDuration($processing_time, $reset_time_on_new_attempt) <=> $b->getRemainingDuration($processing_time, $reset_time_on_new_attempt), 'last_access' => static fn(Participant $a, Participant $b) => $a->getLastAccess() <=> $b->getLastAccess(), - 'status_of_attempt' => static fn( + 'status_of_attempt' => fn( Participant $a, Participant $b - ) => $a->getAttemptOverviewInformation()?->getStatusOfAttempt() - <=> $b->getAttemptOverviewInformation()?->getStatusOfAttempt(), + ) => strcmp( + $a->getAttemptOverviewInformation()?->getStatusOfAttempt()->getTranslation($this->lng) ?? StatusOfAttempt::NOT_YET_STARTED->getTranslation($this->lng), + $b->getAttemptOverviewInformation()?->getStatusOfAttempt()->getTranslation($this->lng) ?? StatusOfAttempt::NOT_YET_STARTED->getTranslation($this->lng) + ), 'reached_points' => static fn( Participant $a, Participant $b @@ -239,8 +241,8 @@ private function getPostLoadOrderFields(): array 'test_passed' => static fn( Participant $a, Participant $b - ) => $a->getAttemptOverviewInformation()?->hasPassingMark() - <=> $b->getAttemptOverviewInformation()?->hasPassingMark(), + ) => $b->getAttemptOverviewInformation()?->hasPassingMark() + <=> $a->getAttemptOverviewInformation()?->hasPassingMark(), 'mark' => static fn( Participant $a, Participant $b @@ -405,7 +407,8 @@ private function getColumns(): array if ($this->test_access->checkParticipantsResultsAccess()) { $columns['reached_points'] = $column_factory->text($this->lng->txt('tst_reached_points')) - ->withIsSortable(true); + ->withIsSortable(true) + ->withOrderingLabels(...$column_factory->number($this->lng->txt('tst_reached_points'))->getOrderingLabels()); $columns['nr_of_answered_questions'] = $column_factory->text($this->lng->txt('tst_answered_questions')) ->withIsOptional(true, false) ->withIsSortable(true); diff --git a/components/ILIAS/Test/src/Results/Data/StatusOfAttempt.php b/components/ILIAS/Test/src/Results/Data/StatusOfAttempt.php index 8bd4cea334e6..d2d1a9be753c 100644 --- a/components/ILIAS/Test/src/Results/Data/StatusOfAttempt.php +++ b/components/ILIAS/Test/src/Results/Data/StatusOfAttempt.php @@ -20,6 +20,8 @@ namespace ILIAS\Test\Results\Data; +use ILIAS\Language\Language; + enum StatusOfAttempt: string { case NOT_YET_STARTED = 'not_started'; @@ -53,4 +55,9 @@ public static function build(int $current_attempt, ?int $last_finished_attempt, return StatusOfAttempt::tryFrom($finalized_by); } + + public function getTranslation(Language $lng): string + { + return $lng->txt($this->value); + } }