From 4b0948aa61847e03c87e612fa46f2e37c9de0cb3 Mon Sep 17 00:00:00 2001
From: felmer <franz-josef.elmer@id.ethz.ch>
Date: Sun, 7 May 2023 15:03:50 +0200
Subject: [PATCH] SSDM-13489: Fixing bug in flow resolver of SFTP view: fcs
 files in WELL samples are not shown

---
 .../eln-tree/resolver-plugins/flow.py              | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/ui-eln-lims/src/core-plugins/eln-lims/1/dss/file-system-plugins/eln-tree/resolver-plugins/flow.py b/ui-eln-lims/src/core-plugins/eln-lims/1/dss/file-system-plugins/eln-tree/resolver-plugins/flow.py
index 88e924b7a2a..1719e5eca79 100644
--- a/ui-eln-lims/src/core-plugins/eln-lims/1/dss/file-system-plugins/eln-tree/resolver-plugins/flow.py
+++ b/ui-eln-lims/src/core-plugins/eln-lims/1/dss/file-system-plugins/eln-tree/resolver-plugins/flow.py
@@ -6,7 +6,7 @@ import script
 
 
 def addSampleChildNodes(path, samplePermId, sampleType, response, acceptor, context):
-    dataSets = getDataSetsOfSampleAndItsDescendants(samplePermId, context)
+    dataSets = getDataSetsOfSampleAndItsDescendants(samplePermId, False, context)
     filteredDataSets = []
     for dataSet in dataSets:
         if acceptor.acceptDataSet(dataSet):
@@ -14,7 +14,7 @@ def addSampleChildNodes(path, samplePermId, sampleType, response, acceptor, cont
     script.addDataSetFileNodesFor(path, filteredDataSets, response, acceptor, context)
 
 def addSampleChildNodesWithPlates(path, samplePermId, sampleType, response, acceptor, context):
-    dataSets = getDataSetsOfSampleAndItsDescendants(samplePermId, context)
+    dataSets = getDataSetsOfSampleAndItsDescendants(samplePermId, True, context)
     filteredDataSets = []
     for dataSet in dataSets:
         sampleTypeCode = dataSet.getSample().getType().getCode()
@@ -23,16 +23,16 @@ def addSampleChildNodesWithPlates(path, samplePermId, sampleType, response, acce
     script.addDataSetFileNodesFor(path, filteredDataSets, response, acceptor, context)
     script.addSampleSampleChildNodes(path, samplePermId, response, acceptor, context)
 
-def getDataSetsOfSampleAndItsDescendants(samplePermId, context):
+def getDataSetsOfSampleAndItsDescendants(samplePermId, supressWells, context):
     samplePermIds = []
-    gatherAllDescendants(samplePermIds, samplePermId, context)
+    gatherAllDescendants(samplePermIds, samplePermId, supressWells, context)
     dataSetSearchCriteria = DataSetSearchCriteria()
     dataSetSearchCriteria.withOrOperator()
     for id in samplePermIds:
         dataSetSearchCriteria.withSample().withPermId().thatEquals(id)
     return script.getDataSets(dataSetSearchCriteria, context)
 
-def gatherAllDescendants(samplePermIds, samplePermId, context):
+def gatherAllDescendants(samplePermIds, samplePermId, supressWells, context):
     samplePermIds.append(samplePermId)
     id = SamplePermId(samplePermId)
     fetchOptions = SampleFetchOptions()
@@ -40,8 +40,8 @@ def gatherAllDescendants(samplePermIds, samplePermId, context):
     children = context.getApi().getSamples(context.getSessionToken(), [id], fetchOptions)[id].getChildren()
     for child in children:
         sampleTypeCode = child.getType().getCode()
-        if not sampleTypeCode.endswith("_WELL"):
-            gatherAllDescendants(samplePermIds, child.getPermId().getPermId(), context)
+        if not supressWells or not sampleTypeCode.endswith("_WELL"):
+            gatherAllDescendants(samplePermIds, child.getPermId().getPermId(), supressWells, context)
 
 for t in ["FACS_ARIA", "INFLUX", "MOFLO_XDP", "S3E", "SONY_SH800S", "SONY_MA900"]:
     acceptor.hideSampleType("%s_SPECIMEN" % t)
-- 
GitLab