diff --git a/sources/AppBundle/Controller/Admin/HomeAction.php b/sources/AppBundle/Controller/Admin/HomeAction.php index 32b2a1cf6..7910aaedf 100644 --- a/sources/AppBundle/Controller/Admin/HomeAction.php +++ b/sources/AppBundle/Controller/Admin/HomeAction.php @@ -49,7 +49,7 @@ public function __invoke(): Response $info = []; if ($event->lastsOneDay()) { $ticketsLabel = 'entrées'; - $tickets = $stats->firstDay->confirmed + $stats->firstDay->pending; + $tickets = $stats->firstDay->paid; if ($event->getSeats()) { $percentage = floor(($tickets * 100) / $event->getSeats()); $tickets = $tickets . ' / ' . $event->getSeats(); @@ -59,8 +59,8 @@ public function __invoke(): Response $info['statistics'][$ticketsLabel] = $tickets; } else { - $info['statistics']['entrées (premier jour)'] = $stats->firstDay->confirmed + $stats->firstDay->pending; - $info['statistics']['entrées (deuxième jour)'] = $stats->secondDay->confirmed + $stats->secondDay->pending; + $info['statistics']['entrées (premier jour)'] = $stats->firstDay->paid; + $info['statistics']['entrées (deuxième jour)'] = $stats->secondDay->paid; } $info['title'] = $event->getTitle(); $info['subtitle'] = 'Inscriptions'; diff --git a/sources/AppBundle/Event/Model/EventStats/DailyStats.php b/sources/AppBundle/Event/Model/EventStats/DailyStats.php index 9dee87f1e..c7f188d21 100644 --- a/sources/AppBundle/Event/Model/EventStats/DailyStats.php +++ b/sources/AppBundle/Event/Model/EventStats/DailyStats.php @@ -10,5 +10,6 @@ public function __construct( public int $registered, public int $confirmed, public int $pending, + public int $paid, ) {} } diff --git a/sources/AppBundle/Event/Model/Repository/EventStatsRepository.php b/sources/AppBundle/Event/Model/Repository/EventStatsRepository.php index 0493793a4..f9dc475fd 100644 --- a/sources/AppBundle/Event/Model/Repository/EventStatsRepository.php +++ b/sources/AppBundle/Event/Model/Repository/EventStatsRepository.php @@ -118,7 +118,13 @@ private function getStatsForDay(int $eventId, string $day, ?Datetime $from = nul ->executeQuery() ->fetchOne(); - return new DailyStats($registered, $confirmed, $pending); + $queryBuilder = clone $baseQueryBuilder; + $paid = $queryBuilder->andWhere('etat = :state') + ->setParameter('state', Ticket::STATUS_PAID) + ->executeQuery() + ->fetchOne(); + + return new DailyStats($registered, $confirmed, $pending, $paid); } public function getCFPStats(int $eventId): CFPStats diff --git a/sources/AppBundle/Slack/MessageFactory.php b/sources/AppBundle/Slack/MessageFactory.php index 6ab7ba178..34cfc4443 100644 --- a/sources/AppBundle/Slack/MessageFactory.php +++ b/sources/AppBundle/Slack/MessageFactory.php @@ -212,7 +212,7 @@ public function createMessageForTicketStats(Event $event, EventStatsRepository $ ; if ($event->lastsOneDay()) { - $tickets = $eventStats->firstDay->confirmed + $eventStats->firstDay->pending; + $tickets = $eventStats->firstDay->paid; if ($event->getSeats()) { $percentage = floor(($tickets * 100) / $event->getSeats()); $tickets = $tickets . ' / ' . $event->getSeats() . " ($percentage%)"; @@ -223,9 +223,9 @@ public function createMessageForTicketStats(Event $event, EventStatsRepository $ } else { $attachment ->addField((new Field())->setShort(true)->setTitle('Premier jour') - ->setValue($eventStats->firstDay->confirmed + $eventStats->firstDay->pending)) + ->setValue($eventStats->firstDay->paid)) ->addField((new Field())->setShort(true)->setTitle('Deuxième jour') - ->setValue($eventStats->secondDay->confirmed + $eventStats->secondDay->pending)) + ->setValue($eventStats->secondDay->paid)) ; }