mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Resolve "Erreur dans le regroupement par service du référent de parcours"
This commit is contained in:
parent
19fa308c06
commit
2ff500b00e
5
.changes/unreleased/Fixed-20250120-130410.yaml
Normal file
5
.changes/unreleased/Fixed-20250120-130410.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
kind: Fixed
|
||||||
|
body: '[export] Fix aggregation of referrer''s scope and job: fix the date range comparison'
|
||||||
|
time: 2025-01-20T13:04:10.856929843+01:00
|
||||||
|
custom:
|
||||||
|
Issue: "348"
|
@ -50,18 +50,9 @@ readonly class ReferrerScopeAggregator implements AggregatorInterface, DataTrans
|
|||||||
Join::WITH,
|
Join::WITH,
|
||||||
$qb->expr()->andX(
|
$qb->expr()->andX(
|
||||||
$qb->expr()->eq("{$p}_userHistory.accompanyingPeriod", 'acp.id'),
|
$qb->expr()->eq("{$p}_userHistory.accompanyingPeriod", 'acp.id'),
|
||||||
$qb->expr()->andX(
|
// check that the user is referrer when the accompanying period is opened
|
||||||
// check that the user is referrer when the accompanying period is opened
|
"OVERLAPSI (acp.openingDate, acp.closingDate), ({$p}_userHistory.startDate, {$p}_userHistory.endDate) = TRUE",
|
||||||
$qb->expr()->gte('COALESCE(acp.closingDate, CURRENT_TIMESTAMP())', "{$p}_userHistory.startDate"),
|
"OVERLAPSI (:{$p}_startDate, :{$p}_endDate), ({$p}_userHistory.startDate, {$p}_userHistory.endDate) = TRUE"
|
||||||
$qb->expr()->orX(
|
|
||||||
$qb->expr()->isNull("{$p}_userHistory.endDate"),
|
|
||||||
$qb->expr()->lt('COALESCE(acp.openingDate, CURRENT_TIMESTAMP())', "{$p}_userHistory.endDate")
|
|
||||||
)
|
|
||||||
),
|
|
||||||
$qb->expr()->andX(
|
|
||||||
"{$p}_userHistory.startDate <= :{$p}_endDate",
|
|
||||||
"COALESCE({$p}_userHistory.endDate, CURRENT_TIMESTAMP()) > :{$p}_startDate"
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->leftJoin(
|
->leftJoin(
|
||||||
@ -69,18 +60,9 @@ readonly class ReferrerScopeAggregator implements AggregatorInterface, DataTrans
|
|||||||
"{$p}_scopeHistory",
|
"{$p}_scopeHistory",
|
||||||
Join::WITH,
|
Join::WITH,
|
||||||
$qb->expr()->andX(
|
$qb->expr()->andX(
|
||||||
$qb->expr()->eq("{$p}_scopeHistory.user", "{$p}_userHistory.user"),
|
"{$p}_scopeHistory.user = {$p}_userHistory.user",
|
||||||
$qb->expr()->andX(
|
"OVERLAPSI ({$p}_scopeHistory.startDate, {$p}_scopeHistory.endDate), ({$p}_userHistory.startDate, {$p}_userHistory.endDate) = TRUE",
|
||||||
$qb->expr()->lte("{$p}_scopeHistory.startDate", "{$p}_userHistory.startDate"),
|
"OVERLAPSI (:{$p}_startDate, :{$p}_endDate), ({$p}_userHistory.startDate, {$p}_userHistory.endDate) = TRUE"
|
||||||
$qb->expr()->orX(
|
|
||||||
$qb->expr()->isNull("{$p}_scopeHistory.endDate"),
|
|
||||||
$qb->expr()->gt("{$p}_scopeHistory.endDate", "{$p}_userHistory.startDate")
|
|
||||||
)
|
|
||||||
),
|
|
||||||
$qb->expr()->andX(
|
|
||||||
"{$p}_scopeHistory.startDate <= :{$p}_endDate",
|
|
||||||
"COALESCE({$p}_scopeHistory.endDate, CURRENT_TIMESTAMP()) > :{$p}_startDate"
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->setParameter("{$p}_startDate", $this->rollingDateConverter->convert($data['start_date']))
|
->setParameter("{$p}_startDate", $this->rollingDateConverter->convert($data['start_date']))
|
||||||
|
@ -50,17 +50,9 @@ final readonly class UserJobAggregator implements AggregatorInterface, DataTrans
|
|||||||
Join::WITH,
|
Join::WITH,
|
||||||
$qb->expr()->andX(
|
$qb->expr()->andX(
|
||||||
$qb->expr()->eq("{$p}_userHistory.accompanyingPeriod", 'acp.id'),
|
$qb->expr()->eq("{$p}_userHistory.accompanyingPeriod", 'acp.id'),
|
||||||
$qb->expr()->andX(
|
// check that the user is referrer when the accompanying period is opened
|
||||||
$qb->expr()->gte('COALESCE(acp.closingDate, CURRENT_TIMESTAMP())', "{$p}_userHistory.startDate"),
|
"OVERLAPSI (acp.openingDate, acp.closingDate), ({$p}_userHistory.startDate, {$p}_userHistory.endDate) = TRUE",
|
||||||
$qb->expr()->orX(
|
"OVERLAPSI (:{$p}_startDate, :{$p}_endDate), ({$p}_userHistory.startDate, {$p}_userHistory.endDate) = TRUE"
|
||||||
$qb->expr()->isNull("{$p}_userHistory.endDate"),
|
|
||||||
$qb->expr()->lt('COALESCE(acp.closingDate, CURRENT_TIMESTAMP())', "{$p}_userHistory.endDate")
|
|
||||||
)
|
|
||||||
),
|
|
||||||
$qb->expr()->andX(
|
|
||||||
"{$p}_userHistory.startDate <= :{$p}_endDate",
|
|
||||||
"COALESCE({$p}_userHistory.endDate, CURRENT_TIMESTAMP()) > :{$p}_startDate"
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->leftJoin(
|
->leftJoin(
|
||||||
@ -68,18 +60,9 @@ final readonly class UserJobAggregator implements AggregatorInterface, DataTrans
|
|||||||
"{$p}_jobHistory",
|
"{$p}_jobHistory",
|
||||||
Join::WITH,
|
Join::WITH,
|
||||||
$qb->expr()->andX(
|
$qb->expr()->andX(
|
||||||
$qb->expr()->eq("{$p}_jobHistory.user", "{$p}_userHistory.user"),
|
"{$p}_jobHistory.user = {$p}_userHistory.user",
|
||||||
$qb->expr()->andX(
|
"OVERLAPSI ({$p}_jobHistory.startDate, {$p}_jobHistory.endDate), ({$p}_userHistory.startDate, {$p}_userHistory.endDate) = TRUE",
|
||||||
$qb->expr()->lte("{$p}_jobHistory.startDate", "{$p}_userHistory.startDate"),
|
"OVERLAPSI (:{$p}_startDate, :{$p}_endDate), ({$p}_jobHistory.startDate, {$p}_jobHistory.endDate) = TRUE"
|
||||||
$qb->expr()->orX(
|
|
||||||
$qb->expr()->isNull("{$p}_jobHistory.endDate"),
|
|
||||||
$qb->expr()->gt("{$p}_jobHistory.endDate", "{$p}_userHistory.startDate")
|
|
||||||
)
|
|
||||||
),
|
|
||||||
$qb->expr()->andX(
|
|
||||||
"{$p}_jobHistory.startDate <= :{$p}_endDate",
|
|
||||||
"COALESCE({$p}_jobHistory.endDate, CURRENT_TIMESTAMP()) > :{$p}_startDate"
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->setParameter("{$p}_startDate", $this->rollingDateConverter->convert($data['start_date']))
|
->setParameter("{$p}_startDate", $this->rollingDateConverter->convert($data['start_date']))
|
||||||
|
@ -73,7 +73,7 @@ final class UserJobAggregatorTest extends AbstractAggregatorTest
|
|||||||
public static function getFormData(): array
|
public static function getFormData(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
['start_date' => new RollingDate(RollingDate::T_WEEK_CURRENT_START), 'end_date' => new RollingDate(RollingDate::T_TODAY)],
|
['start_date' => new RollingDate(RollingDate::T_YEAR_PREVIOUS_START), 'end_date' => new RollingDate(RollingDate::T_TODAY)],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ final class UserJobAggregatorTest extends AbstractAggregatorTest
|
|||||||
$em->createQueryBuilder()
|
$em->createQueryBuilder()
|
||||||
->select('count(acp.id)')
|
->select('count(acp.id)')
|
||||||
->from(AccompanyingPeriod::class, 'acp')
|
->from(AccompanyingPeriod::class, 'acp')
|
||||||
->join('acp.job', 'acpjob'),
|
->leftJoin('acp.job', 'acpjob'),
|
||||||
$em->createQueryBuilder()
|
$em->createQueryBuilder()
|
||||||
->select('count(acp.id)')
|
->select('count(acp.id)')
|
||||||
->from(AccompanyingPeriod::class, 'acp'),
|
->from(AccompanyingPeriod::class, 'acp'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user