You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently there are around 100 duplicates with discrepancies(different allow values). As part of Queries to fix duplicate privileges #746, they will be dealt with. But there are duplicates with same allow value. If users update the value from webapp, it will update only one of the duplicates and result in more discrepancies.
It is taking more time to identify the active orgs and the right privilege values. More discrepancies will lead to vicious cycle where we are unable to progress in this task:
AC:
Execute a query such that we retain only the latest group privilege with the same allow value as the duplicates. For the rest update, allow to false and voided to true along with audit info.
Make sure not to void the duplicates with discrepancies.
Sample query:
WITH group_privileges_duplicates AS (
SELECT ROW_NUMBER() OVER
(PARTITION BY group_id,privilege_id,subject_type_id,program_id,program_encounter_type_id,encounter_type_id,checklist_detail_id,allow
ORDER BY id desc) AS rn FROM group_privilege where is_voided=false
) update group_privilege SET is_voided=true, allow = false, last_modified_date_time={}, last_modified_by_id={} FROM group_privileges_duplicates where id in (
select id from group_privileges_duplicates WHERE rn > 1);
The text was updated successfully, but these errors were encountered:
mahalakshme
changed the title
Void duplicates with same allow value to avoid further duplicates with discrepencies
Handle duplicates with same allow value to avoid further duplicates with discrepancies
Jul 16, 2024
Context:
AC:
Sample query:
The text was updated successfully, but these errors were encountered: