Fixed: [export][person][by age] use lower maximum age if not set, to avoid postgresql error

This commit is contained in:
Julien Fastré 2022-10-14 22:33:58 +02:00
parent c07cd2b715
commit f1e92887fd
2 changed files with 3 additions and 1 deletions

View File

@ -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');

View File

@ -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'));