From 05430b87026d5f14c1b0e854857bf8b23660631f Mon Sep 17 00:00:00 2001 From: Dimitri Gritsajuk Date: Tue, 5 Nov 2024 15:21:31 +0100 Subject: [PATCH] [VoteAg] display alert on D-2 --- src/JeMengage/Alert/Provider/ElectionAlertProvider.php | 6 +++++- src/Repository/VotingPlatform/DesignationRepository.php | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/JeMengage/Alert/Provider/ElectionAlertProvider.php b/src/JeMengage/Alert/Provider/ElectionAlertProvider.php index f2f79e2cd8..9ac9b000f7 100644 --- a/src/JeMengage/Alert/Provider/ElectionAlertProvider.php +++ b/src/JeMengage/Alert/Provider/ElectionAlertProvider.php @@ -20,7 +20,11 @@ public function getAlerts(Adherent $adherent): array { $designations = $this->electionManager->findActiveDesignations( $adherent, - [DesignationTypeEnum::LOCAL_POLL, DesignationTypeEnum::CONSULTATION, DesignationTypeEnum::VOTE], + [ + DesignationTypeEnum::LOCAL_POLL, + DesignationTypeEnum::CONSULTATION, + DesignationTypeEnum::VOTE + ], ); if (!$designations) { diff --git a/src/Repository/VotingPlatform/DesignationRepository.php b/src/Repository/VotingPlatform/DesignationRepository.php index 07ea41d2d2..a126e83abf 100644 --- a/src/Repository/VotingPlatform/DesignationRepository.php +++ b/src/Repository/VotingPlatform/DesignationRepository.php @@ -137,6 +137,7 @@ public function findAllActiveForAdherent(Adherent $adherent, array $types = [], END AS HIDDEN score' ) ->where('DATE_ADD(designation.voteEndDate, 3, \'DAY\') > :now') + ->andWhere('DATE_SUB(designation.voteStartDate, 2, \'DAY\') < :now') ->andWhere('designation.isCanceled = false') ->setParameters(['now' => new \DateTime()]) ->setMaxResults($limit)