DX: Fix aggregator: "group activity by reason"

This commit is contained in:
Julien Fastré 2023-11-20 18:07:06 +01:00
parent b05ed86d1e
commit 2883e085ed
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
2 changed files with 5 additions and 6 deletions

View File

@ -0,0 +1,5 @@
kind: Fixed
body: 'Export: fix loading of "group activity by reasons"'
time: 2023-11-20T17:49:52.416508936+01:00
custom:
Issue: "190"

View File

@ -99,12 +99,6 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
public function getLabels($key, array $values, $data) public function getLabels($key, array $values, $data)
{ {
match ($data['level']) {
'reasons' => $this->activityReasonRepository->findBy(['id' => $values]),
'categories' => $this->activityReasonCategoryRepository->findBy(['id' => $values]),
default => throw new \RuntimeException(sprintf("The level data '%s' is invalid.", $data['level'])),
};
return function ($value) use ($data) { return function ($value) use ($data) {
if ('_header' === $value) { if ('_header' === $value) {
return 'reasons' === $data['level'] ? 'Group by reasons' : 'Group by categories of reason'; return 'reasons' === $data['level'] ? 'Group by reasons' : 'Group by categories of reason';