From bda3661a9b0a021af17d2b2e48b40f22792bdda2 Mon Sep 17 00:00:00 2001 From: aignatov-bio <47317017+aignatov-bio@users.noreply.github.com> Date: Mon, 27 Feb 2023 17:17:12 +0100 Subject: [PATCH] Fix duplicate keywords in protocol table [SCI-8009] (#5034) --- app/datatables/protocols_datatable.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"',