diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-03-10 11:59:40 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-03-10 12:33:12 +0900 |
| commit | 508cfca506d5c4f43d9f9a7377b43d25b2790e6b (patch) | |
| tree | 337d2370810a0427f969a5a50b54c23ecf2eb251 /services/app/src | |
| parent | 1b51b9cf1ea993357af6b76f306e04cdade95bb7 (diff) | |
| download | phperkaigi-2024-albatross-508cfca506d5c4f43d9f9a7377b43d25b2790e6b.tar.gz phperkaigi-2024-albatross-508cfca506d5c4f43d9f9a7377b43d25b2790e6b.tar.zst phperkaigi-2024-albatross-508cfca506d5c4f43d9f9a7377b43d25b2790e6b.zip | |
change score chart to ranking chart
Diffstat (limited to 'services/app/src')
| -rw-r--r-- | services/app/src/App.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/services/app/src/App.php b/services/app/src/App.php index 0c7e3d2..f2f38f4 100644 --- a/services/app/src/App.php +++ b/services/app/src/App.php @@ -256,13 +256,14 @@ final class App if ($quiz === null) { throw new HttpNotFoundException($request); } + $currentUser = $this->getCurrentUser($request); + $isAdmin = $currentUser !== null ? $currentUser->is_admin : false; if ($quiz->isRankingHidden()) { $ranking = null; } else { - $ranking = $answerRepo->getRankingByBestScores($quiz->quiz_id, upto: 20); + $ranking = $answerRepo->getRankingByBestScores($quiz->quiz_id, upto: 20, show_admin: $isAdmin); } - $currentUser = $this->getCurrentUser($request); return $this->render($request, $response, 'quiz_view.html.twig', [ 'page_title' => "問題 #{$quiz->quiz_id}", 'quiz' => $quiz, @@ -964,7 +965,7 @@ final class App ])->withStatus(403); } - $correctAnswers = $answerRepo->listAllCorrectAnswers($quiz->quiz_id); + $correctAnswers = $answerRepo->listAllCorrectAnswers($quiz->quiz_id, show_admin: $isAdmin); $stats = []; foreach ($correctAnswers as $answer) { |
