Fix duplicate keywords in protocol table [SCI-8009] (#5034)

This commit is contained in:
aignatov-bio 2023-02-27 17:17:12 +01:00 committed by GitHub
parent e88b84000b
commit bda3661a9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -172,7 +172,7 @@ class ProtocolsDatatable < CustomDatatable
def get_raw_records
get_raw_records_base.select(
'"protocols".*',
'STRING_AGG("protocol_keywords"."name", \', \') AS "protocol_keywords_str"',
'STRING_AGG(DISTINCT("protocol_keywords"."name"), \', \') AS "protocol_keywords_str"',
'COUNT(DISTINCT("protocol_versions"."id")) + 1 AS "nr_of_versions"', # User assignments generate duplicates
'COUNT("protocol_drafts"."id") AS "nr_of_drafts"',
'COUNT("user_assignments"."id") AS "nr_of_assigned_users"',