From f1d72b0fd32a204b903e49ebf64e730b67dd2341 Mon Sep 17 00:00:00 2001
From: Xiao Gui <xgui3783@gmail.com>
Date: Tue, 8 Dec 2020 16:09:02 +0100
Subject: [PATCH] bugfix: modality filter not working

---
 deploy/datasets/query.js | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/deploy/datasets/query.js b/deploy/datasets/query.js
index e89cc3d08..69116f2b4 100644
--- a/deploy/datasets/query.js
+++ b/deploy/datasets/query.js
@@ -126,8 +126,18 @@ const getDs = ({ user }) => (user
       /**
        * remove duplicates
        */
-      const currSet = new Set(acc.map(v => v['fullId']))
-      if (currSet.has(curr['fullId'])) return [...acc]
+      const existingEntryIdx = acc.findIndex(v => v['fullId'] === curr['fullId'])
+      if (existingEntryIdx >= 0) {
+        const returnArr = [...acc].splice(existingEntryIdx, 1, {
+          ...acc[existingEntryIdx],
+          ...curr,
+          parcellationRegion: [
+            ...(curr['parcellationRegion'] || []),
+            ...(acc[existingEntryIdx]['parcellationRegion'] || [])
+          ]
+        })
+        return returnArr
+      }
       else return acc.concat(curr)
     }, [])
   })
-- 
GitLab