mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
[person][export] Fixed: use left join for related entities in accompanying course aggregators
This commit is contained in:
parent
ca6fde934b
commit
cf9b9b3c75
@ -15,6 +15,7 @@ and this project adheres to
|
||||
* [activity][export] Feature: improve label for aliases in "Filter by activity type"
|
||||
* [activity][export] DX/Feature: use of an `ActivityTypeRepositoryInterface` instead of the old-style EntityRepository
|
||||
* [person][export] Fixed: some inconsistency with date filter on accompanying courses
|
||||
* [person][export] Fixed: use left join for related entities in accompanying course aggregators
|
||||
|
||||
## Test releases
|
||||
|
||||
|
@ -40,18 +40,11 @@ class AdministrativeLocationAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acploc', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acp.administrativeLocation', 'acploc');
|
||||
$qb->leftJoin('acp.administrativeLocation', 'acploc');
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(acp.administrativeLocation) AS location_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('location_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('location_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@ -71,6 +64,10 @@ class AdministrativeLocationAggregator implements AggregatorInterface
|
||||
return 'Administrative location';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$l = $this->locationRepository->find($value);
|
||||
|
||||
return $l->getName() . ' (' . $this->translatableStringHelper->localize($l->getLocationType()->getTitle()) . ')';
|
||||
|
@ -15,6 +15,7 @@ use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use Chill\PersonBundle\Repository\AccompanyingPeriod\ClosingMotiveRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
@ -26,10 +27,10 @@ class ClosingMotiveAggregator implements AggregatorInterface
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
ClosingMotiveRepository $motiveRepository,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
$this->motiveRepository = $em->getRepository(ClosingMotive::class);
|
||||
$this->motiveRepository = $motiveRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
@ -40,19 +41,8 @@ class ClosingMotiveAggregator implements AggregatorInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acpmotive', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acp.closingMotive', 'acpmotive');
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(acp.closingMotive) AS closingmotive_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('closingmotive_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('closingmotive_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@ -72,6 +62,10 @@ class ClosingMotiveAggregator implements AggregatorInterface
|
||||
return 'Closing motive';
|
||||
}
|
||||
|
||||
if (NULL === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$cm = $this->motiveRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize(
|
||||
|
@ -35,14 +35,7 @@ class ConfidentialAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$qb->addSelect('acp.confidential AS confidential_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('confidential_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('confidential_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
|
@ -44,15 +44,8 @@ final class DurationAggregator implements AggregatorInterface
|
||||
// et ajouter une fonction custom qui calcule plus précisément les intervals, comme doctrineum/date-interval
|
||||
// https://packagist.org/packages/doctrineum/date-interval#3.1.0 (mais composer fait un conflit de dépendance)
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('duration_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('duration_aggregator');
|
||||
}
|
||||
|
||||
$qb->orderBy('duration_aggregator');
|
||||
$qb->addOrderBy('duration_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
|
@ -35,14 +35,7 @@ class EmergencyAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$qb->addSelect('acp.emergency AS emergency_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('emergency_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('emergency_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
|
@ -41,22 +41,15 @@ final class EvaluationAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acpw', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acp.works', 'acpw');
|
||||
$qb->leftJoin('acp.works', 'acpw');
|
||||
}
|
||||
|
||||
if (!in_array('workeval', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acpw.accompanyingPeriodWorkEvaluations', 'workeval');
|
||||
$qb->leftJoin('acpw.accompanyingPeriodWorkEvaluations', 'workeval');
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(workeval.evaluation) AS evaluation_aggregator');
|
||||
|
||||
$groupby = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('evaluation_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('evaluation_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@ -76,6 +69,10 @@ final class EvaluationAggregator implements AggregatorInterface
|
||||
return 'Evaluation';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$e = $this->evaluationRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize(
|
||||
|
@ -35,14 +35,7 @@ class IntensityAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$qb->addSelect('acp.intensity AS intensity_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('intensity_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('intensity_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
|
@ -40,18 +40,11 @@ final class JobAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acpjob', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acp.job', 'acpjob');
|
||||
$qb->leftJoin('acp.job', 'acpjob');
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(acp.job) AS job_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('job_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('job_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@ -71,6 +64,10 @@ final class JobAggregator implements AggregatorInterface
|
||||
return 'Job';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$j = $this->jobRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize(
|
||||
|
@ -42,18 +42,11 @@ final class OriginAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acporigin', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acp.origin', 'acporigin');
|
||||
$qb->leftJoin('acp.origin', 'acporigin');
|
||||
}
|
||||
|
||||
$qb->addSelect('acporigin.id AS origin_aggregator');
|
||||
|
||||
$groupby = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('origin_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('origin_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@ -73,6 +66,10 @@ final class OriginAggregator implements AggregatorInterface
|
||||
return 'Origin';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$o = $this->repository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize(
|
||||
|
@ -40,18 +40,11 @@ final class ReferrerAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acpuser', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acp.user', 'acpuser');
|
||||
$qb->leftJoin('acp.user', 'acpuser');
|
||||
}
|
||||
|
||||
$qb->addSelect('acpuser.id AS referrer_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('referrer_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('referrer_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@ -71,6 +64,10 @@ final class ReferrerAggregator implements AggregatorInterface
|
||||
return 'Referrer';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$r = $this->userRepository->find($value);
|
||||
|
||||
return $this->userRender->renderString($r, []);
|
||||
|
@ -57,15 +57,7 @@ final class RequestorAggregator implements AggregatorInterface
|
||||
END ) AS requestor_aggregator
|
||||
");
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('requestor_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('requestor_aggregator');
|
||||
}
|
||||
|
||||
// TODO 'order by' does not works !
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
|
@ -40,18 +40,11 @@ final class ScopeAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acpscope', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acp.scopes', 'acpscope');
|
||||
$qb->leftJoin('acp.scopes', 'acpscope');
|
||||
}
|
||||
|
||||
$qb->addSelect('acpscope.id as scope_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('scope_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('scope_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@ -71,6 +64,10 @@ final class ScopeAggregator implements AggregatorInterface
|
||||
return 'Scope';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$s = $this->scopeRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize(
|
||||
|
@ -41,18 +41,12 @@ final class SocialActionAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acpw', $qb->getAllAliases(), true)) {
|
||||
// here, we will only see accompanying period linked with a socialAction
|
||||
$qb->join('acp.works', 'acpw');
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(acpw.socialAction) AS socialaction_aggregator'); // DISTINCT ??
|
||||
|
||||
$groupby = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addSelect('IDENTITY(acpw.socialAction) AS socialaction_aggregator');
|
||||
$qb->addGroupBy('socialaction_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('socialaction_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@ -72,6 +66,10 @@ final class SocialActionAggregator implements AggregatorInterface
|
||||
return 'Social action';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$sa = $this->actionRepository->find($value);
|
||||
|
||||
return $this->actionRender->renderString($sa, []);
|
||||
|
@ -40,18 +40,12 @@ final class SocialIssueAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acpsocialissue', $qb->getAllAliases(), true)) {
|
||||
// we will see accompanying period linked with social issues
|
||||
$qb->join('acp.socialIssues', 'acpsocialissue');
|
||||
}
|
||||
|
||||
$qb->addSelect('acpsocialissue.id as socialissue_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('socialissue_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('socialissue_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
|
@ -41,15 +41,9 @@ final class StepAggregator implements AggregatorInterface //, FilterInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$qb->addSelect('acp.step AS step_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('step_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('step_aggregator');
|
||||
}
|
||||
|
||||
/*
|
||||
// add date in where clause
|
||||
$where = $qb->getDQLPart('where');
|
||||
|
||||
@ -69,6 +63,7 @@ final class StepAggregator implements AggregatorInterface //, FilterInterface
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->setParameter('ondate', $data['on_date'], Types::DATE_MUTABLE);
|
||||
*/
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
|
@ -39,15 +39,8 @@ class EvaluationTypeAggregator implements AggregatorInterface
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$qb->addSelect('IDENTITY(workeval.evaluation) AS evaluationtype_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('evaluationtype_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('evaluationtype_aggregator');
|
||||
}
|
||||
$qb->addSelect('IDENTITY(workeval.evaluation) AS eval_evaluationtype_aggregator');
|
||||
$qb->addGroupBy('eval_evaluationtype_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@ -67,6 +60,10 @@ class EvaluationTypeAggregator implements AggregatorInterface
|
||||
return 'Evaluation type';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$ev = $this->evaluationRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize($ev->getTitle());
|
||||
@ -75,7 +72,7 @@ class EvaluationTypeAggregator implements AggregatorInterface
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['evaluationtype_aggregator'];
|
||||
return ['eval_evaluationtype_aggregator'];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
|
@ -44,14 +44,7 @@ final class ActionTypeAggregator implements AggregatorInterface
|
||||
}
|
||||
|
||||
$qb->addSelect('acpwsocialaction.id as action_type_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('action_type_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('action_type_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn()
|
||||
@ -71,6 +64,10 @@ final class ActionTypeAggregator implements AggregatorInterface
|
||||
return 'Social Action Type';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$sa = $this->socialActionRepository->find($value);
|
||||
|
||||
return $this->actionRender->renderString($sa, []);
|
||||
|
@ -38,18 +38,11 @@ final class GoalAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('goal', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acpw.goals', 'goal');
|
||||
$qb->leftJoin('acpw.goals', 'goal');
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(goal.goal) as goal_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('goal_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('goal_aggregator');
|
||||
}
|
||||
$qb->addSelect('IDENTITY(goal.goal) as acpw_goal_aggregator');
|
||||
$qb->addGroupBy('acpw_goal_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@ -69,6 +62,10 @@ final class GoalAggregator implements AggregatorInterface
|
||||
return 'Goal Type';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$g = $this->goalRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize(
|
||||
@ -79,7 +76,7 @@ final class GoalAggregator implements AggregatorInterface
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['goal_aggregator'];
|
||||
return ['acpw_goal_aggregator'];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
|
@ -40,18 +40,11 @@ final class JobAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acpwuser', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acpw.referrers', 'acpwuser');
|
||||
$qb->leftJoin('acpw.referrers', 'acpwuser');
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(acpwuser.userJob) as job_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('job_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('job_aggregator');
|
||||
}
|
||||
$qb->addSelect('IDENTITY(acpwuser.userJob) as job_aggregator')
|
||||
->addGroupBy('job_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@ -71,6 +64,10 @@ final class JobAggregator implements AggregatorInterface
|
||||
return 'Job';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$j = $this->jobRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize(
|
||||
|
@ -40,18 +40,11 @@ final class ReferrerAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acpwuser', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acpw.referrers', 'acpwuser');
|
||||
$qb->leftJoin('acpw.referrers', 'acpwuser');
|
||||
}
|
||||
|
||||
$qb->addSelect('acpwuser.id AS referrer_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('referrer_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('referrer_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@ -71,6 +64,10 @@ final class ReferrerAggregator implements AggregatorInterface
|
||||
return 'Referrer';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$r = $this->userRepository->find($value);
|
||||
|
||||
return $this->userRender->renderString($r, []);
|
||||
|
@ -41,15 +41,8 @@ final class ResultAggregator implements AggregatorInterface
|
||||
$qb->join('acpw.results', 'result');
|
||||
}
|
||||
|
||||
$qb->addSelect('result.id as result_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('result_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('result_aggregator');
|
||||
}
|
||||
$qb->addSelect('result.id AS acpw_result_aggregator');
|
||||
$qb->addGroupBy('acpw_result_aggregator');
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@ -69,6 +62,10 @@ final class ResultAggregator implements AggregatorInterface
|
||||
return 'Result Type';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$r = $this->resultRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize(
|
||||
@ -79,7 +76,7 @@ final class ResultAggregator implements AggregatorInterface
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['result_aggregator'];
|
||||
return ['acpw_result_aggregator'];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
|
@ -40,18 +40,11 @@ final class ScopeAggregator implements AggregatorInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('acpwuser', $qb->getAllAliases(), true)) {
|
||||
$qb->join('acpw.referrers', 'acpwuser');
|
||||
$qb->leftJoin('acpw.referrers', 'acpwuser');
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(acpwuser.mainScope) as scope_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('scope_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('scope_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@ -71,6 +64,10 @@ final class ScopeAggregator implements AggregatorInterface
|
||||
return 'Scope';
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$s = $this->scopeRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize(
|
||||
|
@ -98,7 +98,7 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface
|
||||
$qb->join('acpw.accompanyingPeriodWorkEvaluations', 'workeval');
|
||||
}
|
||||
|
||||
$qb->select('COUNT(workeval.id) AS export_result');
|
||||
$qb->select('COUNT(DISTINCT workeval.id) AS export_result');
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user