Fix issue with duration aggregator as month

This commit is contained in:
Julien Fastré 2023-10-24 14:17:28 +02:00
parent 7bff5ce39e
commit 36b0844e79
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB

View File

@ -38,7 +38,7 @@ final readonly class DurationAggregator implements AggregatorInterface
match ($data['precision']) {
'day' => $qb->addSelect('(COALESCE(acp.closingDate, :now) - acp.openingDate) AS duration_aggregator'),
'week' => $qb->addSelect('(COALESCE(acp.closingDate, :now) - acp.openingDate) / 7 AS duration_aggregator'),
'month' => $qb->addSelect('(EXTRACT (MONTH FROM AGE(COALESCE(acp.closingDate, :now), acp.openingDate)) * 12 +
'month' => $qb->addSelect('(EXTRACT (YEAR FROM AGE(COALESCE(acp.closingDate, :now), acp.openingDate)) * 12 +
EXTRACT (MONTH FROM AGE(COALESCE(acp.closingDate, :now), acp.openingDate))) AS duration_aggregator'),
default => throw new \LogicException('precision not supported: '.$data['precision']),
};