[export] fix calendar scopeAggregator query + unit test

This commit is contained in:
2023-09-26 16:00:42 +02:00
parent 28583f4193
commit f18ee2383c
4 changed files with 50 additions and 17 deletions

View File

@@ -26,7 +26,7 @@ use Symfony\Component\Form\FormBuilderInterface;
final readonly class JobAggregator implements AggregatorInterface
{
private const PREFIX = 'cal_agg';
private const PREFIX = 'cal_agg_job';
public function __construct(
private RollingDateConverterInterface $rollingDateConverter,
@@ -50,12 +50,12 @@ final readonly class JobAggregator implements AggregatorInterface
)
->leftJoin(
UserJobHistory::class,
"{$p}_ujh",
"{$p}_history",
Expr\Join::WITH,
$qb->expr()->eq("{$p}_ujh.user", "{$p}_user")
$qb->expr()->eq("{$p}_history.user", "{$p}_user")
)
->andWhere("{$p}_ujh.startDate <= :{$p}_at AND ({$p}_ujh.endDate IS NULL OR {$p}_ujh.endDate > :{$p}_at)")
->addSelect("IDENTITY({$p}_ujh.job) AS {$p}_select")
->andWhere("{$p}_history.startDate <= :{$p}_at AND ({$p}_history.endDate IS NULL OR {$p}_history.endDate > :{$p}_at)")
->addSelect("IDENTITY({$p}_history.job) AS {$p}_select")
->setParameter(
"{$p}_at",
$this->rollingDateConverter->convert($data['job_at'])
@@ -71,7 +71,7 @@ final readonly class JobAggregator implements AggregatorInterface
public function buildForm(FormBuilderInterface $builder)
{
$builder->add('job_at', PickRollingDateType::class, [
'label' => 'export.aggregator.calendar.Calc date',
'label' => 'export.aggregator.calendar.agent_job.Calc date',
]);
}