Skip to content

Commit

Permalink
fixed arrival date grouping
Browse files Browse the repository at this point in the history
  • Loading branch information
Lung committed Mar 27, 2024
1 parent 879d7bb commit bc0aeb5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Participant/ParticipantRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,18 +272,18 @@ public function getContingentStatistic(
public function getIstArrivalStatistic(
Event $event,
): array {
$qb = $this->connection->select('participant.arrival_date, COUNT(*)')->from($this->getTable());
$qb = $this->connection->select('date(participant.arrival_date) as ad, COUNT(*)')->from($this->getTable());
$qb->join('user')->as('u')->on('u.id = participant.user_id');

$qb->where('u.event_id = %i', $event->id);
$qb->where('participant.role = %s', ParticipantRole::Ist);
$qb->where('u.status = %s', UserStatus::Paid);

$qb->groupBy('participant.arrival_date');
$qb->orderBy('participant.arrival_date');
$qb->groupBy('date(participant.arrival_date)');
$qb->orderBy('date(participant.arrival_date)');

/** @var array<string,int> $rows */
$rows = $qb->fetchPairs('arrival_date', 'count');
$rows = $qb->fetchPairs('ad', 'count');

return $rows;
}
Expand Down

0 comments on commit bc0aeb5

Please sign in to comment.