From 4f0801961841b4f12422497a28e6589897767156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 20 Mar 2024 12:36:11 +0100 Subject: [PATCH] Fix the join in the user list (admin): show only current user job --- .changes/unreleased/Fixed-20240320-123527.yaml | 6 ++++++ src/Bundle/ChillMainBundle/Repository/UserRepository.php | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changes/unreleased/Fixed-20240320-123527.yaml diff --git a/.changes/unreleased/Fixed-20240320-123527.yaml b/.changes/unreleased/Fixed-20240320-123527.yaml new file mode 100644 index 000000000..a9e13ae9e --- /dev/null +++ b/.changes/unreleased/Fixed-20240320-123527.yaml @@ -0,0 +1,6 @@ +kind: Fixed +body: 'Fix the join between job and user in the user list (admin): show only the current + user job' +time: 2024-03-20T12:35:27.885282599+01:00 +custom: + Issue: "267" diff --git a/src/Bundle/ChillMainBundle/Repository/UserRepository.php b/src/Bundle/ChillMainBundle/Repository/UserRepository.php index dc5a9adfe..5c5dff4d0 100644 --- a/src/Bundle/ChillMainBundle/Repository/UserRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/UserRepository.php @@ -106,8 +106,8 @@ final readonly class UserRepository implements UserRepositoryInterface FROM users u LEFT JOIN chill_main_civility civility ON u.civility_id = civility.id LEFT JOIN centers mainCenter ON u.maincenter_id = mainCenter.id - LEFT JOIN chill_main_user_job_history userJobHistory ON u.id = userJobHistory.user_id - LEFT JOIN chill_main_user_job userJob ON userJobHistory.job_id = userJob.id AND tstzrange(userJobHistory.startdate, userJobHistory.enddate) @> NOW() + LEFT JOIN chill_main_user_job_history userJobHistory ON u.id = userJobHistory.user_id AND tstzrange(userJobHistory.startdate, userJobHistory.enddate) @> NOW() + LEFT JOIN chill_main_user_job userJob ON userJobHistory.job_id = userJob.id LEFT JOIN chill_main_user_scope_history userScopeHistory ON u.id = userScopeHistory.user_id AND tstzrange(userScopeHistory.startdate, userScopeHistory.enddate) @> NOW() LEFT JOIN scopes mainScope ON userScopeHistory.scope_id = mainScope.id LEFT JOIN chill_main_location currentLocation ON u.currentlocation_id = currentLocation.id