From f30fb141dd96b748fddbbeefbfde893524f25285 Mon Sep 17 00:00:00 2001 From: Yi-Jyun Pan Date: Sun, 20 Oct 2024 02:17:23 +0800 Subject: [PATCH] fix(overview): Pass user to daily chart --- src/Controller/OverviewCardsController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Controller/OverviewCardsController.php b/src/Controller/OverviewCardsController.php index 7b11896..cb26ff5 100644 --- a/src/Controller/OverviewCardsController.php +++ b/src/Controller/OverviewCardsController.php @@ -140,6 +140,7 @@ public function eventHistory( */ #[Route('/events/daily-chart', name: 'events_daily_chart')] public function eventDailyChart( + #[CurrentUser] User $user, SolutionEventRepository $solutionEventRepository, ChartBuilderInterface $chartBuilder, TranslatorInterface $translator, @@ -147,11 +148,14 @@ public function eventDailyChart( $startedAt = new \DateTimeImmutable('-7 days'); $eventsQuery = $solutionEventRepository->createQueryBuilder('e') + ->join('e.submitter', 'u') ->select('DATE(e.createdAt) as date, COUNT(e.id) as count') ->where('e.createdAt >= :date') + ->andWhere('u = :user') ->orderBy('date', 'ASC') ->groupBy('date') ->setParameter('date', $startedAt) + ->setParameter('user', $user) ->getQuery(); /**