Class: Robot::Verification::SourceDestControlBeds

Inherits:
Base
  • Object
show all
Defined in:
app/models/robot/verification/source_dest_control_beds.rb

Overview

This class of verification is for robots where the source plates and control plates have distinct beds

Instance Attribute Summary

Attributes inherited from Base

#errors

Instance Method Summary collapse

Methods inherited from Base

#all_picks, #pick_number_to_expected_layout, #pick_numbers, #record_plate_types, #valid_submission?, #validate_barcode_params

Instance Method Details

#layout_data_object(data_object) ⇒ Object



7
8
9
10
11
12
13
14
# File 'app/models/robot/verification/source_dest_control_beds.rb', line 7

def layout_data_object(data_object)
  destination = data_object['destination']
  source = data_object['source']
  dest_barcode_index = barcode_to_plate_index(destination)
  source_barcode_index = source_barcode_to_plate_index(destination, source)
  control_barcode_index = control_barcode_to_plate_index(destination, source)
  [dest_barcode_index, source_barcode_index, control_barcode_index]
end

#valid_control_plates_on_robot?(beds, plates, robot, batch, all_expected_plate_layout) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
34
35
36
37
38
# File 'app/models/robot/verification/source_dest_control_beds.rb', line 31

def valid_control_plates_on_robot?(beds, plates, robot, batch, all_expected_plate_layout)
  # it is valid for this type of robot not to have any control plates in the batch
  # e.g. for a second batch onto a partial destination plate that already contains controls
  # e.g. when no controls are needed
  return true if all_expected_plate_layout[2].blank?

  valid_plates_on_robot?(beds, plates, 'CTRL', robot, batch, all_expected_plate_layout[2])
end

#valid_plate_locations?(params, batch, robot, expected_plate_layout) ⇒ Boolean

rubocop:todo Metrics/MethodLength

Returns:

  • (Boolean)


16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/models/robot/verification/source_dest_control_beds.rb', line 16

def valid_plate_locations?(params, batch, robot, expected_plate_layout) # rubocop:todo Metrics/MethodLength
  return false unless super
  unless valid_control_plates_on_robot?(
           params[:control_bed_barcodes],
           params[:control_plate_barcodes],
           robot,
           batch,
           expected_plate_layout
         )
    return false
  end

  true
end