diff --git a/app/datatables/protocols_datatable.rb b/app/datatables/protocols_datatable.rb index aea0a38c9..72f1b874b 100644 --- a/app/datatables/protocols_datatable.rb +++ b/app/datatables/protocols_datatable.rb @@ -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"',