mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Adapt calendar exports to not take into account calendars of canceled accompanying periods
This commit is contained in:
parent
29983cc2ad
commit
b38f5800d9
@ -13,6 +13,7 @@ namespace Chill\CalendarBundle\Export\Export;
|
|||||||
|
|
||||||
use Chill\CalendarBundle\Export\Declarations;
|
use Chill\CalendarBundle\Export\Declarations;
|
||||||
use Chill\CalendarBundle\Repository\CalendarRepository;
|
use Chill\CalendarBundle\Repository\CalendarRepository;
|
||||||
|
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
|
||||||
use Chill\MainBundle\Export\ExportInterface;
|
use Chill\MainBundle\Export\ExportInterface;
|
||||||
use Chill\MainBundle\Export\FormatterInterface;
|
use Chill\MainBundle\Export\FormatterInterface;
|
||||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||||
@ -27,9 +28,15 @@ class CountCalendars implements ExportInterface, GroupedExportInterface
|
|||||||
{
|
{
|
||||||
private CalendarRepository $calendarRepository;
|
private CalendarRepository $calendarRepository;
|
||||||
|
|
||||||
public function __construct(CalendarRepository $calendarRepository)
|
private AccompanyingCourseExportHelper $accompanyingCourseExportHelper;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
CalendarRepository $calendarRepository,
|
||||||
|
AccompanyingCourseExportHelper $accompanyingCourseExportHelper
|
||||||
|
)
|
||||||
{
|
{
|
||||||
$this->calendarRepository = $calendarRepository;
|
$this->calendarRepository = $calendarRepository;
|
||||||
|
$this->accompanyingCourseExportHelper = $accompanyingCourseExportHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder)
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
@ -98,6 +105,9 @@ class CountCalendars implements ExportInterface, GroupedExportInterface
|
|||||||
$qb = $this->calendarRepository->createQueryBuilder('cal');
|
$qb = $this->calendarRepository->createQueryBuilder('cal');
|
||||||
|
|
||||||
$qb->select('COUNT(cal.id) AS export_result');
|
$qb->select('COUNT(cal.id) AS export_result');
|
||||||
|
$qb->join('cal.accompanyingPeriod', 'acp');
|
||||||
|
|
||||||
|
$this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||||
|
|
||||||
return $qb;
|
return $qb;
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ namespace Chill\CalendarBundle\Export\Export;
|
|||||||
|
|
||||||
use Chill\CalendarBundle\Export\Declarations;
|
use Chill\CalendarBundle\Export\Declarations;
|
||||||
use Chill\CalendarBundle\Repository\CalendarRepository;
|
use Chill\CalendarBundle\Repository\CalendarRepository;
|
||||||
|
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
|
||||||
use Chill\MainBundle\Export\ExportInterface;
|
use Chill\MainBundle\Export\ExportInterface;
|
||||||
use Chill\MainBundle\Export\FormatterInterface;
|
use Chill\MainBundle\Export\FormatterInterface;
|
||||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||||
@ -26,10 +27,15 @@ class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
|
|||||||
{
|
{
|
||||||
private CalendarRepository $calendarRepository;
|
private CalendarRepository $calendarRepository;
|
||||||
|
|
||||||
|
private AccompanyingCourseExportHelper $accompanyingCourseExportHelper;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
CalendarRepository $calendarRepository
|
CalendarRepository $calendarRepository,
|
||||||
|
AccompanyingCourseExportHelper $accompanyingCourseExportHelper
|
||||||
|
|
||||||
) {
|
) {
|
||||||
$this->calendarRepository = $calendarRepository;
|
$this->calendarRepository = $calendarRepository;
|
||||||
|
$this->accompanyingCourseExportHelper = $accompanyingCourseExportHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder): void
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
@ -92,8 +98,10 @@ class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
|
|||||||
{
|
{
|
||||||
$qb = $this->calendarRepository->createQueryBuilder('cal');
|
$qb = $this->calendarRepository->createQueryBuilder('cal');
|
||||||
|
|
||||||
$qb
|
$qb->select('AVG(cal.endDate - cal.startDate) AS export_result');
|
||||||
->select('AVG(cal.endDate - cal.startDate) AS export_result');
|
$qb->join('cal.accompanyingPeriod', 'acp');
|
||||||
|
|
||||||
|
$this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||||
|
|
||||||
return $qb;
|
return $qb;
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ namespace Chill\CalendarBundle\Export\Export;
|
|||||||
|
|
||||||
use Chill\CalendarBundle\Export\Declarations;
|
use Chill\CalendarBundle\Export\Declarations;
|
||||||
use Chill\CalendarBundle\Repository\CalendarRepository;
|
use Chill\CalendarBundle\Repository\CalendarRepository;
|
||||||
|
use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
|
||||||
use Chill\MainBundle\Export\ExportInterface;
|
use Chill\MainBundle\Export\ExportInterface;
|
||||||
use Chill\MainBundle\Export\FormatterInterface;
|
use Chill\MainBundle\Export\FormatterInterface;
|
||||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||||
@ -26,10 +27,14 @@ class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
|
|||||||
{
|
{
|
||||||
private CalendarRepository $calendarRepository;
|
private CalendarRepository $calendarRepository;
|
||||||
|
|
||||||
|
private AccompanyingCourseExportHelper $accompanyingCourseExportHelper;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
CalendarRepository $calendarRepository
|
CalendarRepository $calendarRepository,
|
||||||
|
AccompanyingCourseExportHelper $accompanyingCourseExportHelper
|
||||||
) {
|
) {
|
||||||
$this->calendarRepository = $calendarRepository;
|
$this->calendarRepository = $calendarRepository;
|
||||||
|
$this->accompanyingCourseExportHelper = $accompanyingCourseExportHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder): void
|
public function buildForm(FormBuilderInterface $builder): void
|
||||||
@ -92,8 +97,10 @@ class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
|
|||||||
{
|
{
|
||||||
$qb = $this->calendarRepository->createQueryBuilder('cal');
|
$qb = $this->calendarRepository->createQueryBuilder('cal');
|
||||||
|
|
||||||
$qb
|
$qb->select('SUM(cal.endDate - cal.startDate) AS export_result');
|
||||||
->select('SUM(cal.endDate - cal.startDate) AS export_result');
|
$qb->join('cal.accompanyingPeriod', 'acp');
|
||||||
|
|
||||||
|
$this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
|
||||||
|
|
||||||
return $qb;
|
return $qb;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user