mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Fix geographical unit stat aggregator: date range on association with left join
This commit is contained in:
parent
dd75cb695c
commit
4d20a46717
5
.changes/unreleased/Fixed-20231106-220250.yaml
Normal file
5
.changes/unreleased/Fixed-20231106-220250.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
kind: Fixed
|
||||
body: 'Export: fix aggregator by geographical unit on person: avoid inconsistencies'
|
||||
time: 2023-11-06T22:02:50.364184265+01:00
|
||||
custom:
|
||||
Issue: "185"
|
@ -19,6 +19,7 @@ use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use Doctrine\ORM\Query\Expr\Join;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
@ -35,21 +36,26 @@ class GeographicalUnitAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data): void
|
||||
{
|
||||
$qb
|
||||
->leftJoin('person.householdAddresses', 'person_geog_agg_current_household_address')
|
||||
->leftJoin('person_geog_agg_current_household_address.address', 'person_geog_agg_address')
|
||||
->leftJoin('person_geog_agg_address.geographicalUnits', 'person_geog_agg_geog_unit')
|
||||
->andWhere(
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->isNull('person_geog_agg_current_household_address'),
|
||||
$qb->expr()->andX(
|
||||
$qb->expr()->lte('person_geog_agg_current_household_address.validFrom', ':person_geog_agg_date'),
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->isNull('person_geog_agg_current_household_address.validTo'),
|
||||
$qb->expr()->gt('person_geog_agg_current_household_address.validTo', ':person_geog_agg_date')
|
||||
)
|
||||
->leftJoin(
|
||||
'person.householdAddresses',
|
||||
'person_geog_agg_current_household_address',
|
||||
Join::WITH,
|
||||
$qb->expr()->andX(
|
||||
$qb->expr()->lte('person_geog_agg_current_household_address.validFrom', ':person_geog_agg_date'),
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->isNull('person_geog_agg_current_household_address.validTo'),
|
||||
$qb->expr()->gt('person_geog_agg_current_household_address.validTo', ':person_geog_agg_date')
|
||||
)
|
||||
)
|
||||
)
|
||||
->leftJoin(
|
||||
'person_geog_agg_current_household_address.address',
|
||||
'person_geog_agg_address'
|
||||
)
|
||||
->leftJoin(
|
||||
'person_geog_agg_address.geographicalUnits',
|
||||
'person_geog_agg_geog_unit'
|
||||
)
|
||||
->andWhere(
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->isNull('person_geog_agg_geog_unit'),
|
||||
|
Loading…
x
Reference in New Issue
Block a user