From f1e92887fd49368d92f4a67e87fd3a5b5dfb7e8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 14 Oct 2022 22:33:58 +0200 Subject: [PATCH] Fixed: [export][person][by age] use lower maximum age if not set, to avoid postgresql error --- .../ChillPersonBundle/Export/Export/CountAccompanyingCourse.php | 2 ++ .../ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php index 7e5a01f3d..8c8744dfd 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php @@ -99,6 +99,7 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface $qb = $this->repository->createQueryBuilder('acp'); $qb + ->andWhere('acp.step != :count_acp_step') ->andWhere( $qb->expr()->exists( 'SELECT 1 FROM ' . AccompanyingPeriodParticipation::class . ' acl_count_part @@ -107,6 +108,7 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface ' ) ) + ->setParameter('count_acp_step', AccompanyingPeriod::STEP_DRAFT) ->setParameter('authorized_centers', $centers); $qb->select('COUNT(DISTINCT acp.id) AS export_result'); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php index 1c6b362d4..218ae483e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php @@ -35,7 +35,7 @@ class AgeFilter implements ExportElementValidatedInterface, FilterInterface $where = $qb->getDQLPart('where'); $min = null !== $data['min_age'] ? $data['min_age'] : 0; - $max = null !== $data['max_age'] ? $data['max_age'] : 3000; + $max = null !== $data['max_age'] ? $data['max_age'] : 150; $calc = $data['date_calc']; $minDate = $calc->sub(new DateInterval('P' . $max . 'Y'));