exports evaluation: fix root query from acp

This commit is contained in:
Mathieu Jaumotte 2022-08-11 14:04:15 +02:00
parent 6e467a62d4
commit b8d187c82b
3 changed files with 8 additions and 9 deletions

View File

@ -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');

View File

@ -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');

View File

@ -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']);
}
/**