diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregator.php new file mode 100644 index 000000000..005d012f9 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregator.php @@ -0,0 +1,86 @@ +translator->trans('accompanying_period.'.$step); + }; + } + + public function getQueryKeys($data) + { + return [ + self::KEY, + ]; + } + + public function getTitle() + { + return 'export.aggregator.step_history.by_step.title'; + } + + public function addRole(): ?string + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb + ->addSelect('acpstephistory.step AS '.self::KEY) + ->addGroupBy(self::KEY); + } + + public function applyOn() + { + return Declarations::ACP_STEP_HISTORY; + } +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php new file mode 100644 index 000000000..f71b06351 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/AccompanyingPeriodStepHistoryAggregators/ByStepAggregatorTest.php @@ -0,0 +1,58 @@ +get(EntityManagerInterface::class); + + $qb = $em->createQueryBuilder() + ->select('COUNT(DISTINCT acpstephistory.id) As export_result') + ->from(AccompanyingPeriodStepHistory::class, 'acpstephistory') + ->join('acpstephistory.period', 'acp'); + + return [ + $qb, + ]; + } +} diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index e865cab76..8614a00db 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -1042,6 +1042,11 @@ export: at_date: Date de calcul de l'adresse header: Code postal + step_history: + by_step: + title: Grouper les changements de statut du parcours par étape + header: Nouveau statut du parcours + course: by-user: title: Grouper les parcours par usager participant