mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Add condition to household export queries to exclude accompanying periods that are in draft.
This commit is contained in:
parent
0da12cdc2e
commit
4d72933edb
6
.changes/unreleased/Fixed-20231218-162157.yaml
Normal file
6
.changes/unreleased/Fixed-20231218-162157.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
kind: Fixed
|
||||
body: Fix the household export query to exclude accompanying periods that are in draft
|
||||
state.
|
||||
time: 2023-12-18T16:21:57.827287397+01:00
|
||||
custom:
|
||||
Issue: ""
|
@ -17,6 +17,7 @@ use Chill\MainBundle\Export\GroupedExportInterface;
|
||||
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
@ -121,7 +122,9 @@ class CountHouseholdInPeriod implements ExportInterface, GroupedExportInterface
|
||||
->join('acppart.accompanyingPeriod', 'acp')
|
||||
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL')
|
||||
->andWhere('hmember.startDate <= :count_household_at_date AND (hmember.endDate IS NULL OR hmember.endDate > :count_household_at_date)')
|
||||
->setParameter('count_household_at_date', $this->rollingDateConverter->convert($data['calc_date']));
|
||||
->andWhere('acp.step != :count_acp_step')
|
||||
->setParameter('count_household_at_date', $this->rollingDateConverter->convert($data['calc_date']))
|
||||
->setParameter('count_acp_step', AccompanyingPeriod::STEP_DRAFT);
|
||||
|
||||
$qb
|
||||
->select('COUNT(DISTINCT household.id) AS household_export_result')
|
||||
|
@ -20,6 +20,7 @@ use Chill\MainBundle\Export\ListInterface;
|
||||
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Household\HouseholdComposition;
|
||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||
@ -144,7 +145,9 @@ class ListHouseholdInPeriod implements ListInterface, GroupedExportInterface
|
||||
->join('acppart.accompanyingPeriod', 'acp')
|
||||
->andWhere('acppart.startDate != acppart.endDate OR acppart.endDate IS NULL')
|
||||
->andWhere('hmember.startDate <= :count_household_at_date AND (hmember.endDate IS NULL OR hmember.endDate > :count_household_at_date)')
|
||||
->setParameter('count_household_at_date', $this->rollingDateConverter->convert($data['calc_date']));
|
||||
->andWhere('acp.step != :list_acp_step')
|
||||
->setParameter('count_household_at_date', $this->rollingDateConverter->convert($data['calc_date']))
|
||||
->setParameter('list_acp_step', AccompanyingPeriod::STEP_DRAFT);
|
||||
|
||||
if ($this->filterStatsByCenters) {
|
||||
$qb
|
||||
|
@ -50,7 +50,7 @@ final class RelationshipApiControllerTest extends WebTestCase
|
||||
->join('p.centerCurrent', 'center_current')
|
||||
->join('center_current.center', 'c')
|
||||
->where('c.name LIKE :name')
|
||||
->andWhere('EXISTS (SELECT 1 FROM ' . Relationship::class . ' r WHERE r.fromPerson = p OR r.toPerson = p)')
|
||||
->andWhere('EXISTS (SELECT 1 FROM '.Relationship::class.' r WHERE r.fromPerson = p OR r.toPerson = p)')
|
||||
->setParameter('name', 'Center A')
|
||||
->getQuery()
|
||||
->setMaxResults(1)
|
||||
@ -62,7 +62,7 @@ final class RelationshipApiControllerTest extends WebTestCase
|
||||
->join('p.centerCurrent', 'center_current')
|
||||
->join('center_current.center', 'c')
|
||||
->where('c.name LIKE :name')
|
||||
->andWhere('NOT EXISTS (SELECT 1 FROM ' . Relationship::class . ' r WHERE r.fromPerson = p OR r.toPerson = p)')
|
||||
->andWhere('NOT EXISTS (SELECT 1 FROM '.Relationship::class.' r WHERE r.fromPerson = p OR r.toPerson = p)')
|
||||
->setParameter('name', 'Center A')
|
||||
->getQuery()
|
||||
->setMaxResults(1)
|
||||
@ -85,7 +85,7 @@ final class RelationshipApiControllerTest extends WebTestCase
|
||||
->join('p.centerCurrent', 'center_current')
|
||||
->join('center_current.center', 'c')
|
||||
->where('c.name LIKE :name')
|
||||
->andWhere('NOT EXISTS (SELECT 1 FROM ' . Relationship::class . ' r WHERE r.fromPerson = p OR r.toPerson = p)')
|
||||
->andWhere('NOT EXISTS (SELECT 1 FROM '.Relationship::class.' r WHERE r.fromPerson = p OR r.toPerson = p)')
|
||||
->setParameter('name', 'Center A')
|
||||
->getQuery()
|
||||
->setMaxResults(2)
|
||||
|
Loading…
x
Reference in New Issue
Block a user