Code Duplication    Length = 17-21 lines in 2 locations

src/senaite/core/browser/samples/multi_results_classic.py 1 location

@@ 92-112 (lines=21) @@
89
            return False
90
        return True
91
92
    def get_samples(self):
93
        """Extract the samples from the request UIDs
94
95
        This might be either a samples container or a sample context
96
        """
97
98
        # fetch objects from request
99
        objs = self.get_objects_from_request()
100
101
        samples = []
102
103
        for obj in objs:
104
            # when coming from the samples listing
105
            if IAnalysisRequest.providedBy(obj):
106
                samples.append(obj)
107
108
        # when coming from the WF menu inside a sample
109
        if IAnalysisRequest.providedBy(self.context):
110
            samples.append(self.context)
111
112
        return self.uniquify_items(samples)
113
114
    def uniquify_items(self, items):
115
        """Uniquify the items with sort order

src/senaite/core/browser/samples/multi_results_transposed.py 1 location

@@ 218-234 (lines=17) @@
215
216
        return analyses
217
218
    def get_samples(self):
219
        """Extract the samples from the request UIDs
220
        """
221
        objs = self.get_objects_from_request()
222
223
        samples = []
224
225
        for obj in objs:
226
            # when coming from the samples listing
227
            if IAnalysisRequest.providedBy(obj):
228
                samples.append(obj)
229
230
        # when coming from the WF menu inside a sample
231
        if IAnalysisRequest.providedBy(self.context):
232
            samples.append(self.context)
233
234
        return self.uniquify_items(samples)
235
236
    def uniquify_items(self, items):
237
        """Uniquify the items with sort order