Add ByDateAggregator to AccompanyingPeriodStepHistoryAggregators

Implemented a new ByDateAggregator in the AccompanyingPeriodStepHistoryAggregators for grouping status changes by date. A corresponding test suite has been included to verify its function. Necessary translations have also been updated.
This commit is contained in:
2024-01-29 12:31:57 +01:00
parent 01785ed494
commit bf97b2a50c
3 changed files with 155 additions and 1 deletions

View File

@@ -0,0 +1,61 @@
<?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\Aggregator\AccompanyingPeriodStepHistoryAggregators;
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodStepHistory;
use Chill\PersonBundle\Export\Enum\DateGroupingChoiceEnum;
use Doctrine\ORM\EntityManagerInterface;
use Chill\PersonBundle\Export\Aggregator\AccompanyingPeriodStepHistoryAggregators\ByDateAggregator;
/**
* @internal
*
* @coversNothing
*/
class ByDateAggregatorTest extends AbstractAggregatorTest
{
public function getAggregator()
{
return new ByDateAggregator();
}
public function getFormData()
{
return [
[
'frequency' => DateGroupingChoiceEnum::YEAR->value,
],
[
'frequency' => DateGroupingChoiceEnum::WEEK->value,
],
[
'frequency' => DateGroupingChoiceEnum::MONTH->value,
],
];
}
public function getQueryBuilders()
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
$qb = $em->createQueryBuilder()
->select('COUNT(DISTINCT acpstephistory.id) As export_result')
->from(AccompanyingPeriodStepHistory::class, 'acpstephistory')
->join('acpstephistory.period', 'acp');
return [
$qb,
];
}
}