mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-09 01:09:51 +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\Service\RollingDate\RollingDateConverterInterface;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
use Chill\PersonBundle\Export\Declarations;
|
use Chill\PersonBundle\Export\Declarations;
|
||||||
|
use Doctrine\ORM\Query\Expr\Join;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
@ -35,21 +36,26 @@ class GeographicalUnitAggregator implements AggregatorInterface
|
|||||||
public function alterQuery(QueryBuilder $qb, $data): void
|
public function alterQuery(QueryBuilder $qb, $data): void
|
||||||
{
|
{
|
||||||
$qb
|
$qb
|
||||||
->leftJoin('person.householdAddresses', 'person_geog_agg_current_household_address')
|
->leftJoin(
|
||||||
->leftJoin('person_geog_agg_current_household_address.address', 'person_geog_agg_address')
|
'person.householdAddresses',
|
||||||
->leftJoin('person_geog_agg_address.geographicalUnits', 'person_geog_agg_geog_unit')
|
'person_geog_agg_current_household_address',
|
||||||
->andWhere(
|
Join::WITH,
|
||||||
$qb->expr()->orX(
|
$qb->expr()->andX(
|
||||||
$qb->expr()->isNull('person_geog_agg_current_household_address'),
|
$qb->expr()->lte('person_geog_agg_current_household_address.validFrom', ':person_geog_agg_date'),
|
||||||
$qb->expr()->andX(
|
$qb->expr()->orX(
|
||||||
$qb->expr()->lte('person_geog_agg_current_household_address.validFrom', ':person_geog_agg_date'),
|
$qb->expr()->isNull('person_geog_agg_current_household_address.validTo'),
|
||||||
$qb->expr()->orX(
|
$qb->expr()->gt('person_geog_agg_current_household_address.validTo', ':person_geog_agg_date')
|
||||||
$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(
|
->andWhere(
|
||||||
$qb->expr()->orX(
|
$qb->expr()->orX(
|
||||||
$qb->expr()->isNull('person_geog_agg_geog_unit'),
|
$qb->expr()->isNull('person_geog_agg_geog_unit'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user