mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Do not sync user which are enabled with UserGroup related to UserJob.
Updated SQL queries to include checks for user.enabled status, ensuring proper handling of both enabled and null states. This improves the synchronization logic by aligning it with user activity and account status conditions.
This commit is contained in:
parent
ebdfa04843
commit
e8bca6a502
@ -87,8 +87,8 @@ final readonly class UserGroupRelatedToUserJobSync implements UserGroupRelatedTo
|
||||
AND chill_main_user_group_user.user_id = u.id
|
||||
AND jh.user_id = u.id AND tsrange(jh.startdate, jh.enddate) @> localtimestamp
|
||||
-- only when the user's jobid is different than the user_group id
|
||||
AND ug.userjob_id IS NOT NULL
|
||||
AND jh.job_id <> ug.userjob_id
|
||||
-- or where the user.enabled is null
|
||||
AND ((ug.userjob_id IS NOT NULL AND jh.job_id <> ug.userjob_id) OR u.enabled IS NULL)
|
||||
SQL;
|
||||
|
||||
$result = $connection->executeQuery($sql);
|
||||
@ -103,7 +103,8 @@ final readonly class UserGroupRelatedToUserJobSync implements UserGroupRelatedTo
|
||||
SELECT cmug.id, jh.user_id
|
||||
FROM chill_main_user_group cmug
|
||||
JOIN chill_main_user_job_history jh ON jh.job_id = cmug.userjob_id AND tsrange(jh.startdate, jh.enddate) @> localtimestamp
|
||||
WHERE cmug.userjob_id IS NOT NULL
|
||||
JOIN users u ON u.id = jh.user_id
|
||||
WHERE cmug.userjob_id IS NOT NULL AND u.enabled IS TRUE
|
||||
ON CONFLICT DO NOTHING
|
||||
SQL;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user