mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-14 14:24:24 +00:00
add missing variables to two exports
This commit is contained in:
parent
e2a12968ce
commit
27bf2893d0
@ -20,11 +20,19 @@ use Chill\MainBundle\Export\GroupedExportInterface;
|
|||||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
|
class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
public function __construct(private readonly CalendarRepository $calendarRepository) {}
|
private readonly bool $filterStatsByCenters;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
private readonly CalendarRepository $calendarRepository,
|
||||||
|
ParameterBagInterface $parameterBag,
|
||||||
|
) {
|
||||||
|
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
||||||
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder): void
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
@ -85,6 +93,8 @@ class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
|
||||||
{
|
{
|
||||||
|
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||||
|
|
||||||
$qb = $this->calendarRepository->createQueryBuilder('cal');
|
$qb = $this->calendarRepository->createQueryBuilder('cal');
|
||||||
|
|
||||||
$qb->select('AVG(cal.endDate - cal.startDate) AS export_result');
|
$qb->select('AVG(cal.endDate - cal.startDate) AS export_result');
|
||||||
|
@ -20,11 +20,20 @@ use Chill\MainBundle\Export\GroupedExportInterface;
|
|||||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
|
class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
|
||||||
{
|
{
|
||||||
public function __construct(private readonly CalendarRepository $calendarRepository) {}
|
private readonly bool $filterStatsByCenters;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
private readonly CalendarRepository $calendarRepository,
|
||||||
|
ParameterBagInterface $parameterBag,
|
||||||
|
) {
|
||||||
|
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder): void
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
{
|
{
|
||||||
@ -85,6 +94,8 @@ class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
|
|||||||
|
|
||||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
|
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
|
||||||
{
|
{
|
||||||
|
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||||
|
|
||||||
$qb = $this->calendarRepository->createQueryBuilder('cal');
|
$qb = $this->calendarRepository->createQueryBuilder('cal');
|
||||||
|
|
||||||
$qb->select('SUM(cal.endDate - cal.startDate) AS export_result');
|
$qb->select('SUM(cal.endDate - cal.startDate) AS export_result');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user