Module: SampleManifest::BarcodePrinterBehaviour

Included in:
SampleManifest
Defined in:
app/models/sample_manifest/barcode_printer_behaviour.rb

Constant Summary collapse

ASSET_TYPE_TO_PRINTER_TYPE =
{
  '1dtube' => [BarcodePrinterType1DTube],
  'plate' => [BarcodePrinterType96Plate, BarcodePrinterType384DoublePlate]
}

Instance Method Summary collapse

Instance Method Details

#applicable_barcode_printersObject


7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/models/sample_manifest/barcode_printer_behaviour.rb', line 7

def applicable_barcode_printers
  printer_type_classes = ASSET_TYPE_TO_PRINTER_TYPE[asset_type]
  printers = []
  if printer_type_classes.nil?
    printers += BarcodePrinter.alphabetical
  else
    printer_type_classes.each do |printer_type_class|
      BarcodePrinterType.where(type: printer_type_class).find_each do |printer_type|
        printers += printer_type.barcode_printers unless printer_type.nil?
      end
    end
  end
  printers
end