SentReceivedAggregator (in activity)

This commit is contained in:
Mathieu Jaumotte 2022-10-31 16:18:10 +01:00 committed by Julien Fastré
parent 6d0622aa38
commit 226f172970
2 changed files with 13 additions and 4 deletions

View File

@ -25,8 +25,8 @@ class SentReceivedAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data) public function alterQuery(QueryBuilder $qb, $data)
{ {
$qb->addSelect('AS activity_sent_received_aggregator') $qb->addSelect('activity.sentReceived AS activity_sentreceived_aggregator')
->addGroupBy('activity_sent_received_aggregator'); ->addGroupBy('activity_sentreceived_aggregator');
} }
public function applyOn(): string public function applyOn(): string
@ -45,12 +45,22 @@ class SentReceivedAggregator implements AggregatorInterface
if ('_header' === $value) { if ('_header' === $value) {
return ''; return '';
} }
switch ($value) {
case 'sent':
return 'is sent';
case 'received':
return 'is received';
default:
throw new \LogicException(sprintf('The value %s is not valid', $value));
}
}; };
} }
public function getQueryKeys($data): array public function getQueryKeys($data): array
{ {
return ['activity_sent_received_aggregator']; return ['activity_sentreceived_aggregator'];
} }
public function getTitle(): string public function getTitle(): string

View File

@ -59,7 +59,6 @@ class CurrentActionAggregator implements AggregatorInterface
default: default:
throw new \LogicException(sprintf('The value %s is not valid', $value)); throw new \LogicException(sprintf('The value %s is not valid', $value));
} }
}; };
} }