Feature: [export] group accompanying period by number of actions

This commit is contained in:
Julien Fastré 2022-11-02 14:05:16 +01:00
parent e6553e71ee
commit 5655f953d7
2 changed files with 13 additions and 4 deletions

View File

@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators;
use Chill\MainBundle\Export\AggregatorInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;
use Chill\PersonBundle\Export\Declarations;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
@ -23,9 +24,9 @@ class ByActionNumberAggregator implements AggregatorInterface
return null;
}
public function alterQuery(QueryBuilder $qb, $data)
public function alterQuery(QueryBuilder $qb, $data): void
{
$qb->addSelect('AS acp_by_action_number_aggregator')
$qb->addSelect('(SELECT COUNT(acp_by_action_action.id) FROM ' . AccompanyingPeriodWork::class . ' acp_by_action_action WHERE acp_by_action_action.accompanyingPeriod = acp) AS acp_by_action_number_aggregator')
->addGroupBy('acp_by_action_number_aggregator');
}
@ -34,17 +35,23 @@ class ByActionNumberAggregator implements AggregatorInterface
return Declarations::ACP_TYPE;
}
public function buildForm(FormBuilderInterface $builder)
public function buildForm(FormBuilderInterface $builder): void
{
// No form needed
}
public function getLabels($key, array $values, $data)
{
return static function ($value): string {
return static function ($value) {
if ('_header' === $value) {
return 'export.aggregator.course.by_number_of_action.Number of actions';
}
if (null === $value) {
return '';
}
return $value;
};
}

View File

@ -1015,6 +1015,8 @@ export:
Household composition: Composition du ménage
Group course by household composition: Grouper les parcours par composition familiale des ménages des usagers concernés
Calc date: Date de calcul de la composition du ménage
by_number_of_action:
Number of actions: Nombre d'actions
filter:
course:
by_user_scope: