mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
DX: rename CountHousehold => CountHouseholdInPeriod.php + add test
This commit is contained in:
parent
d01b6db5dc
commit
1663c6f7c7
@ -26,7 +26,7 @@ use Doctrine\ORM\Query;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class CountHousehold implements ExportInterface, GroupedExportInterface
|
||||
class CountHouseholdInPeriod implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
private const TR_PREFIX = 'export.export.nb_household_with_course.';
|
||||
private readonly bool $filterStatsByCenters;
|
||||
@ -120,6 +120,7 @@ class CountHousehold implements ExportInterface, GroupedExportInterface
|
||||
->join('person.accompanyingPeriodParticipations', 'acppart')
|
||||
->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']));
|
||||
|
||||
$qb
|
||||
@ -135,7 +136,6 @@ class CountHousehold implements ExportInterface, GroupedExportInterface
|
||||
'
|
||||
)
|
||||
)
|
||||
->andWhere('hmember.startDate <= :count_household_at_date AND (hmember.endDate IS NULL OR hmember.endDate > :count_household_at_date)')
|
||||
->setParameter('authorized_centers', $centers);
|
||||
}
|
||||
|
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\PersonBundle\Tests\Export\Export;
|
||||
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
|
||||
use Chill\MainBundle\Test\Export\AbstractExportTest;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use Chill\PersonBundle\Export\Export\CountHouseholdInPeriod;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
class CountHouseholdInPeriodTest extends AbstractExportTest
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
}
|
||||
|
||||
public function getExport()
|
||||
{
|
||||
$em = self::$container->get(EntityManagerInterface::class);
|
||||
$rollingDate = self::$container->get(RollingDateConverterInterface::class);
|
||||
|
||||
yield new CountHouseholdInPeriod($em, $rollingDate, $this->getParameters(true));
|
||||
yield new CountHouseholdInPeriod($em, $rollingDate, $this->getParameters(false));
|
||||
}
|
||||
|
||||
public function getFormData()
|
||||
{
|
||||
return [
|
||||
['calc_date' => new RollingDate(RollingDate::T_TODAY)],
|
||||
];
|
||||
}
|
||||
|
||||
public function getModifiersCombination()
|
||||
{
|
||||
return [
|
||||
[
|
||||
Declarations::HOUSEHOLD_TYPE,
|
||||
Declarations::ACP_TYPE,
|
||||
Declarations::PERSON_TYPE,
|
||||
]];
|
||||
}
|
||||
}
|
@ -1,38 +1,30 @@
|
||||
services:
|
||||
_defaults:
|
||||
autoconfigure: true
|
||||
autowire: true
|
||||
|
||||
## Indicators
|
||||
chill.person.export.count_household:
|
||||
class: Chill\PersonBundle\Export\Export\CountHousehold
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
Chill\PersonBundle\Export\Export\CountHouseholdInPeriod:
|
||||
tags:
|
||||
- { name: chill.export, alias: count_household }
|
||||
|
||||
Chill\PersonBundle\Export\Export\ListHouseholdInPeriod:
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
tags:
|
||||
- { name: chill.export, alias: list_household_in_period }
|
||||
|
||||
## Filters
|
||||
chill.person.export.filter_household_composition:
|
||||
class: Chill\PersonBundle\Export\Filter\HouseholdFilters\CompositionFilter
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
tags:
|
||||
- { name: chill.export_filter, alias: household_composition_filter }
|
||||
|
||||
## Aggregators
|
||||
chill.person.export.aggregator_household_composition:
|
||||
class: Chill\PersonBundle\Export\Aggregator\HouseholdAggregators\CompositionAggregator
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
tags:
|
||||
- { name: chill.export_aggregator, alias: household_composition_aggregator }
|
||||
|
||||
chill.person.export.aggregator_household_childrennumber:
|
||||
class: Chill\PersonBundle\Export\Aggregator\HouseholdAggregators\ChildrenNumberAggregator
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
tags:
|
||||
- { name: chill.export_aggregator, alias: household_childrennumber_aggregator }
|
||||
|
Loading…
x
Reference in New Issue
Block a user