def get_failed_instruments(self):
        """Find invalid instruments

        - instruments who have failed QC tests
        - instruments whose certificate is out of date
        - instruments which are disposed until next calibration test

        Return a dictionary with all info about expired/invalid instruments
        """
        bsc = api.get_tool("bika_setup_catalog")
        insts = bsc(portal_type="Instrument", is_active=True)
        for i in insts:
            i = i.getObject()
            instr = {
                'uid': i.UID(),
                'title': i.Title(),
            }
            if i.isValidationInProgress():
                instr['link'] = '<a href="%s/validations">%s</a>' % (
                    i.absolute_url(), i.Title()
                )
                self.nr_failed += 1
                self.failed['validation'].append(instr)
            elif i.isCalibrationInProgress():
                instr['link'] = '<a href="%s/calibrations">%s</a>' % (
                    i.absolute_url(), i.Title()
                )
                self.nr_failed += 1
                self.failed['calibration'].append(instr)
            elif i.isOutOfDate():
                instr['link'] = '<a href="%s/certifications">%s</a>' % (
                    i.absolute_url(), i.Title()
                )
                self.nr_failed += 1
                self.failed['out-of-date'].append(instr)
            elif not i.isQCValid():
                instr['link'] = '<a href="%s/referenceanalyses">%s</a>' % (
                    i.absolute_url(), i.Title()
                )
                self.nr_failed += 1
                self.failed['qc-fail'].append(instr)
            elif i.getDisposeUntilNextCalibrationTest():
                instr['link'] = '<a href="%s/referenceanalyses">%s</a>' % (
                    i.absolute_url(), i.Title()
                )
                self.nr_failed += 1
                self.failed['next-test'].append(instr)
def get_failed_instruments ( self ) : bsc = api . get_tool ( "bika_setup_catalog" ) insts = bsc ( portal_type = "Instrument" , is_active = True ) for i in insts : i = i . getObject ( ) instr = { 'uid' : i . UID ( ) , 'title' : i . Title ( ) , } if i . isValidationInProgress ( ) : instr [ 'link' ] = '<a href="%s/validations">%s</a>' % ( i . absolute_url ( ) , i . Title ( ) ) self . nr_failed += 1 self . failed [ 'validation' ] . append ( instr ) elif i . isCalibrationInProgress ( ) : instr [ 'link' ] = '<a href="%s/calibrations">%s</a>' % ( i . absolute_url ( ) , i . Title ( ) ) self . nr_failed += 1 self . failed [ 'calibration' ] . append ( instr ) elif i . isOutOfDate ( ) : instr [ 'link' ] = '<a href="%s/certifications">%s</a>' % ( i . absolute_url ( ) , i . Title ( ) ) self . nr_failed += 1 self . failed [ 'out-of-date' ] . append ( instr ) elif not i . isQCValid ( ) : instr [ 'link' ] = '<a href="%s/referenceanalyses">%s</a>' % ( i . absolute_url ( ) , i . Title ( ) ) self . nr_failed += 1 self . failed [ 'qc-fail' ] . append ( instr ) elif i . getDisposeUntilNextCalibrationTest ( ) : instr [ 'link' ] = '<a href="%s/referenceanalyses">%s</a>' % ( i . absolute_url ( ) , i . Title ( ) ) self . nr_failed += 1 self . failed [ 'next-test' ] . append ( instr )
Find invalid instruments

        - instruments who have failed QC tests
        - instruments whose certificate is out of date
        - instruments which are disposed until next calibration test

        Return a dictionary with all info about expired/invalid instruments