From b8d187c82bf3decbe138a5d2436ea370fa617eee Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 11 Aug 2022 14:04:15 +0200 Subject: [PATCH] exports evaluation: fix root query from acp --- .../EvaluationTypeAggregator.php | 3 +-- .../Export/Export/CountEvaluation.php | 11 +++++++---- .../Export/Filter/EvaluationFilters/MaxDateFilter.php | 3 --- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php index d52c410e5..e94290925 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php @@ -76,8 +76,7 @@ class EvaluationTypeAggregator implements AggregatorInterface */ public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('eval.evaluation', 'ev'); - $qb->addSelect('ev.id AS evaluationtype_aggregator'); + $qb->addSelect('IDENTITY(eval.evaluation) AS evaluationtype_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php index 22bd07b0c..98b73c398 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php @@ -5,7 +5,7 @@ namespace Chill\PersonBundle\Export\Export; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; -use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation; +use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Export\Declarations; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter; use Doctrine\ORM\EntityManagerInterface; @@ -17,12 +17,12 @@ use Symfony\Component\Security\Core\Role\Role; class CountEvaluation implements ExportInterface, GroupedExportInterface { - private EntityRepository $evaluationRepository; + private EntityRepository $acpRepository; public function __construct( EntityManagerInterface $em ) { - $this->evaluationRepository = $em->getRepository(AccompanyingPeriodWorkEvaluation::class); + $this->acpRepository = $em->getRepository(AccompanyingPeriod::class); } /** @@ -103,7 +103,10 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface */ public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - $qb = $this->evaluationRepository->createQueryBuilder('eval'); + $qb = $this->acpRepository->createQueryBuilder('acp') + ->join('acp.works', 'acpw') + ->join('acpw.accompanyingPeriodWorkEvaluations', 'eval') + ; $qb->select('COUNT(eval.id) AS export_result'); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php index de84d5877..c69e15d9e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php @@ -12,7 +12,6 @@ use Symfony\Contracts\Translation\TranslatorInterface; class MaxDateFilter implements FilterInterface { - private const MAXDATE_CHOICES = [ 'is specified' => true, 'is not specified' => false, @@ -89,8 +88,6 @@ class MaxDateFilter implements FilterInterface } $qb->add('where', $where); - - dump($data['maxdate']); } /**