mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch '276-take-closing-date-on-period-when-export' into 'master'
Update geographical unit computation for closed periods in exports Closes #276 See merge request Chill-Projet/chill-bundles!687
This commit is contained in:
commit
cb70c322a4
7
.changes/unreleased/Feature-20240429-130102.yaml
Normal file
7
.changes/unreleased/Feature-20240429-130102.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
kind: Feature
|
||||||
|
body: 'Take closing date into account when computing the geographical unit on accompanying
|
||||||
|
period. When a person moved after an accompanying period is closed, the date of
|
||||||
|
closing accompanying period is took into account if it is earlier than the date given by the user.'
|
||||||
|
time: 2024-04-29T13:01:02.463796452+02:00
|
||||||
|
custom:
|
||||||
|
Issue: "276"
|
@ -28,8 +28,11 @@ use Symfony\Component\Form\FormBuilderInterface;
|
|||||||
|
|
||||||
final readonly class GeographicalUnitStatAggregator implements AggregatorInterface
|
final readonly class GeographicalUnitStatAggregator implements AggregatorInterface
|
||||||
{
|
{
|
||||||
public function __construct(private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private TranslatableStringHelperInterface $translatableStringHelper, private RollingDateConverterInterface $rollingDateConverter)
|
public function __construct(
|
||||||
{
|
private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository,
|
||||||
|
private TranslatableStringHelperInterface $translatableStringHelper,
|
||||||
|
private RollingDateConverterInterface $rollingDateConverter
|
||||||
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRole(): ?string
|
public function addRole(): ?string
|
||||||
@ -43,10 +46,10 @@ final readonly class GeographicalUnitStatAggregator implements AggregatorInterfa
|
|||||||
|
|
||||||
$qb->andWhere(
|
$qb->andWhere(
|
||||||
$qb->expr()->andX(
|
$qb->expr()->andX(
|
||||||
'acp_geog_agg_location_history.startDate <= :acp_geog_aggregator_date',
|
'acp_geog_agg_location_history.startDate <= LEAST(:acp_geog_aggregator_date, acp.closingDate)',
|
||||||
$qb->expr()->orX(
|
$qb->expr()->orX(
|
||||||
'acp_geog_agg_location_history.endDate IS NULL',
|
'acp_geog_agg_location_history.endDate IS NULL',
|
||||||
'acp_geog_agg_location_history.endDate > :acp_geog_aggregator_date'
|
'acp_geog_agg_location_history.endDate > LEAST(:acp_geog_aggregator_date, acp.closingDate)'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -58,9 +61,9 @@ final readonly class GeographicalUnitStatAggregator implements AggregatorInterfa
|
|||||||
Join::WITH,
|
Join::WITH,
|
||||||
$qb->expr()->andX(
|
$qb->expr()->andX(
|
||||||
'IDENTITY(acp_geog_agg_address_person_location.person) = IDENTITY(acp_geog_agg_location_history.personLocation)',
|
'IDENTITY(acp_geog_agg_address_person_location.person) = IDENTITY(acp_geog_agg_location_history.personLocation)',
|
||||||
'acp_geog_agg_address_person_location.validFrom <= :acp_geog_aggregator_date',
|
'acp_geog_agg_address_person_location.validFrom <= LEAST(:acp_geog_aggregator_date, acp.closingDate)',
|
||||||
$qb->expr()->orX(
|
$qb->expr()->orX(
|
||||||
'acp_geog_agg_address_person_location.validTo > :acp_geog_aggregator_date',
|
'acp_geog_agg_address_person_location.validTo > LEAST(:acp_geog_aggregator_date, acp.closingDate)',
|
||||||
$qb->expr()->isNull('acp_geog_agg_address_person_location.validTo')
|
$qb->expr()->isNull('acp_geog_agg_address_person_location.validTo')
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -52,18 +52,19 @@ class GeographicalUnitStatFilter implements FilterInterface
|
|||||||
'SELECT
|
'SELECT
|
||||||
1
|
1
|
||||||
FROM '.AccompanyingPeriod\AccompanyingPeriodLocationHistory::class.' acp_geog_filter_location_history
|
FROM '.AccompanyingPeriod\AccompanyingPeriodLocationHistory::class.' acp_geog_filter_location_history
|
||||||
|
JOIN acp_geog_filter_location_history.period acp_geog_filter_location_history_period
|
||||||
LEFT JOIN '.PersonHouseholdAddress::class.' acp_geog_filter_address_person_location
|
LEFT JOIN '.PersonHouseholdAddress::class.' acp_geog_filter_address_person_location
|
||||||
WITH IDENTITY(acp_geog_filter_location_history.personLocation) = IDENTITY(acp_geog_filter_address_person_location.person)
|
WITH IDENTITY(acp_geog_filter_location_history.personLocation) = IDENTITY(acp_geog_filter_address_person_location.person)
|
||||||
AND
|
AND
|
||||||
(acp_geog_filter_address_person_location.validFrom < :acp_geog_filter_date AND (
|
(acp_geog_filter_address_person_location.validFrom < LEAST(:acp_geog_filter_date, acp_geog_filter_location_history_period.closingDate) AND (
|
||||||
acp_geog_filter_address_person_location.validTo IS NULL OR acp_geog_filter_address_person_location.validTo > :acp_geog_filter_date
|
acp_geog_filter_address_person_location.validTo IS NULL OR acp_geog_filter_address_person_location.validTo > LEAST(:acp_geog_filter_date, acp_geog_filter_location_history_period.closingDate)
|
||||||
))
|
))
|
||||||
LEFT JOIN '.Address::class.' acp_geog_filter_address
|
LEFT JOIN '.Address::class.' acp_geog_filter_address
|
||||||
WITH COALESCE(IDENTITY(acp_geog_filter_address_person_location.address), IDENTITY(acp_geog_filter_location_history.addressLocation)) = acp_geog_filter_address.id
|
WITH COALESCE(IDENTITY(acp_geog_filter_address_person_location.address), IDENTITY(acp_geog_filter_location_history.addressLocation)) = acp_geog_filter_address.id
|
||||||
LEFT JOIN acp_geog_filter_address.geographicalUnits acp_geog_filter_units
|
LEFT JOIN acp_geog_filter_address.geographicalUnits acp_geog_filter_units
|
||||||
WHERE
|
WHERE
|
||||||
(acp_geog_filter_location_history.startDate <= :acp_geog_filter_date AND (
|
(acp_geog_filter_location_history.startDate <= LEAST(:acp_geog_filter_date, acp_geog_filter_location_history_period.closingDate) AND (
|
||||||
acp_geog_filter_location_history.endDate IS NULL OR acp_geog_filter_location_history.endDate > :acp_geog_filter_date
|
acp_geog_filter_location_history.endDate IS NULL OR acp_geog_filter_location_history.endDate > LEAST(:acp_geog_filter_date, acp_geog_filter_location_history_period.closingDate)
|
||||||
))
|
))
|
||||||
AND acp_geog_filter_units IN (:acp_geog_filter_units)
|
AND acp_geog_filter_units IN (:acp_geog_filter_units)
|
||||||
AND acp_geog_filter_location_history.period = acp.id
|
AND acp_geog_filter_location_history.period = acp.id
|
||||||
|
Loading…
x
Reference in New Issue
Block a user