diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/CountCalendars.php b/src/Bundle/ChillCalendarBundle/Export/Export/CountCalendars.php index e0391948e..3e96245c9 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Export/CountCalendars.php +++ b/src/Bundle/ChillCalendarBundle/Export/Export/CountCalendars.php @@ -13,6 +13,7 @@ namespace Chill\CalendarBundle\Export\Export; use Chill\CalendarBundle\Export\Declarations; use Chill\CalendarBundle\Repository\CalendarRepository; +use Chill\MainBundle\Export\AccompanyingCourseExportHelper; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; @@ -27,9 +28,15 @@ class CountCalendars implements ExportInterface, GroupedExportInterface { private CalendarRepository $calendarRepository; - public function __construct(CalendarRepository $calendarRepository) + private AccompanyingCourseExportHelper $accompanyingCourseExportHelper; + + public function __construct( + CalendarRepository $calendarRepository, + AccompanyingCourseExportHelper $accompanyingCourseExportHelper + ) { $this->calendarRepository = $calendarRepository; + $this->accompanyingCourseExportHelper = $accompanyingCourseExportHelper; } public function buildForm(FormBuilderInterface $builder) @@ -98,6 +105,9 @@ class CountCalendars implements ExportInterface, GroupedExportInterface $qb = $this->calendarRepository->createQueryBuilder('cal'); $qb->select('COUNT(cal.id) AS export_result'); + $qb->join('cal.accompanyingPeriod', 'acp'); + + $this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); return $qb; } diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarAvgDuration.php b/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarAvgDuration.php index dcbfb695b..696bf02af 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarAvgDuration.php +++ b/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarAvgDuration.php @@ -13,6 +13,7 @@ namespace Chill\CalendarBundle\Export\Export; use Chill\CalendarBundle\Export\Declarations; use Chill\CalendarBundle\Repository\CalendarRepository; +use Chill\MainBundle\Export\AccompanyingCourseExportHelper; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; @@ -26,10 +27,15 @@ class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface { private CalendarRepository $calendarRepository; + private AccompanyingCourseExportHelper $accompanyingCourseExportHelper; + public function __construct( - CalendarRepository $calendarRepository + CalendarRepository $calendarRepository, + AccompanyingCourseExportHelper $accompanyingCourseExportHelper + ) { $this->calendarRepository = $calendarRepository; + $this->accompanyingCourseExportHelper = $accompanyingCourseExportHelper; } public function buildForm(FormBuilderInterface $builder): void @@ -92,8 +98,10 @@ class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface { $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'); + $qb->join('cal.accompanyingPeriod', 'acp'); + + $this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); return $qb; } diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarSumDuration.php b/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarSumDuration.php index 7f509a896..856e6996a 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarSumDuration.php +++ b/src/Bundle/ChillCalendarBundle/Export/Export/StatCalendarSumDuration.php @@ -13,6 +13,7 @@ namespace Chill\CalendarBundle\Export\Export; use Chill\CalendarBundle\Export\Declarations; use Chill\CalendarBundle\Repository\CalendarRepository; +use Chill\MainBundle\Export\AccompanyingCourseExportHelper; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; @@ -26,10 +27,14 @@ class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface { private CalendarRepository $calendarRepository; + private AccompanyingCourseExportHelper $accompanyingCourseExportHelper; + public function __construct( - CalendarRepository $calendarRepository + CalendarRepository $calendarRepository, + AccompanyingCourseExportHelper $accompanyingCourseExportHelper ) { $this->calendarRepository = $calendarRepository; + $this->accompanyingCourseExportHelper = $accompanyingCourseExportHelper; } public function buildForm(FormBuilderInterface $builder): void @@ -92,8 +97,10 @@ class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface { $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'); + $qb->join('cal.accompanyingPeriod', 'acp'); + + $this->accompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb); return $qb; }