From be8901a5c44949c8813efe5746d5eaa290188203 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 16 Sep 2024 15:52:48 +0200 Subject: [PATCH] Fix referrer scope date comparison in aggregator Correct the date comparison logic to use openingDate instead of closingDate when evaluating user history end dates. This ensures accurate grouping by referrer in the accompanying course aggregators. Added a changelog entry for Issue #309. --- .changes/unreleased/Fixed-20240916-155150.yaml | 6 ++++++ .../ReferrerScopeAggregator.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Fixed-20240916-155150.yaml diff --git a/.changes/unreleased/Fixed-20240916-155150.yaml b/.changes/unreleased/Fixed-20240916-155150.yaml new file mode 100644 index 000000000..52382db20 --- /dev/null +++ b/.changes/unreleased/Fixed-20240916-155150.yaml @@ -0,0 +1,6 @@ +kind: Fixed +body: | + Correctly compute the grouping by referrer aggregator +time: 2024-09-16T15:51:50.268336979+02:00 +custom: + Issue: "309" diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php index c183cff70..3525538fd 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerScopeAggregator.php @@ -56,7 +56,7 @@ readonly class ReferrerScopeAggregator implements AggregatorInterface, DataTrans $qb->expr()->gte('COALESCE(acp.closingDate, CURRENT_TIMESTAMP())', "{$p}_userHistory.startDate"), $qb->expr()->orX( $qb->expr()->isNull("{$p}_userHistory.endDate"), - $qb->expr()->lt('COALESCE(acp.closingDate, CURRENT_TIMESTAMP())', "{$p}_userHistory.endDate") + $qb->expr()->lt('COALESCE(acp.openingDate, CURRENT_TIMESTAMP())', "{$p}_userHistory.endDate") ) ), $qb->expr()->andX(