mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-03-16 02:47:45 +00:00
Fix ordering of social actions
Actions with a closing date in the future should be considered as 'still open'.
This commit is contained in:
6
.changes/unreleased/Fixed-20251218-110722.yaml
Normal file
6
.changes/unreleased/Fixed-20251218-110722.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
kind: Fixed
|
||||
body: 'Fix ordering of social actions: actions with a closing date in the future should be considered as ''still open''.'
|
||||
time: 2025-12-18T11:07:22.699897317+01:00
|
||||
custom:
|
||||
Issue: "481"
|
||||
SchemaChange: No schema change
|
||||
@@ -100,9 +100,9 @@ class AccompanyingPeriodWorkRepository implements ObjectRepository
|
||||
$rsm->addRootEntityFromClassMetadata(AccompanyingPeriodWork::class, 'w');
|
||||
|
||||
$sql = "SELECT {$rsm} FROM chill_person_accompanying_period_work w
|
||||
LEFT JOIN chill_person_accompanying_period_work_referrer AS rw ON accompanyingperiodwork_id = w.id
|
||||
AND (rw.enddate IS NULL OR rw.enddate > CURRENT_DATE)
|
||||
WHERE accompanyingPeriod_id = :periodId";
|
||||
LEFT JOIN chill_person_accompanying_period_work_referrer AS rw ON accompanyingperiodwork_id = w.id
|
||||
AND (rw.enddate IS NULL OR rw.enddate > CURRENT_DATE)
|
||||
WHERE accompanyingPeriod_id = :periodId";
|
||||
|
||||
// implement filters
|
||||
|
||||
@@ -136,11 +136,14 @@ class AccompanyingPeriodWorkRepository implements ObjectRepository
|
||||
}
|
||||
|
||||
// set limit and offset
|
||||
$sql .= " ORDER BY
|
||||
CASE WHEN w.enddate IS NULL THEN '-infinity'::timestamp ELSE 'infinity'::timestamp END ASC,
|
||||
w.startdate DESC,
|
||||
w.enddate DESC,
|
||||
w.id DESC";
|
||||
$sql .= ' ORDER BY
|
||||
CASE
|
||||
WHEN w.enddate IS NULL OR w.enddate > CURRENT_DATE THEN 0
|
||||
ELSE 1
|
||||
END ASC,
|
||||
w.startdate DESC,
|
||||
w.enddate DESC,
|
||||
w.id DESC';
|
||||
|
||||
$sql .= ' LIMIT :limit OFFSET :offset';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user