Code Duplication    Length = 12-12 lines in 2 locations

bika/lims/content/method.py 1 location

@@ 210-221 (lines=12) @@
207
        instruments = self.getInstruments()
208
        return len(instruments) == 0 or self.getManualEntryOfResults()
209
210
    def _getCalculations(self):
211
        """Available Calculations registered in Setup
212
        """
213
        bsc = getToolByName(self, "bika_setup_catalog")
214
        items = [(c.UID, c.Title)
215
                 for c in bsc(portal_type="Calculation",
216
                              is_active=True)]
217
        items.sort(lambda x, y: cmp(x[1], y[1]))
218
        items.insert(0, ("", t(_("None"))))
219
        return DisplayList(items)
220
221
    def getInstruments(self):
222
        """Instruments capable to perform this method
223
        """
224
        return self.getBackReferences("InstrumentMethods")

bika/lims/content/instrument.py 1 location

@@ 433-444 (lines=12) @@
430
        items.sort(lambda x, y: cmp(x[1], y[1]))
431
        return DisplayList(items)
432
433
    def _getAvailableMethods(self):
434
        """ Returns the available (active) methods.
435
            One method can be done by multiple instruments, but one
436
            instrument can only be used in one method.
437
        """
438
        bsc = getToolByName(self, 'bika_setup_catalog')
439
        items = [(c.UID, c.Title)
440
                 for c in bsc(portal_type='Method',
441
                              is_active=True)]
442
        items.sort(lambda x, y: cmp(x[1], y[1]))
443
        items.insert(0, ('', t(_('None'))))
444
        return DisplayList(items)
445
446
    def getInstrumentTypes(self):
447
        bsc = getToolByName(self, 'bika_setup_catalog')