Class: Robot
Defined Under Namespace
Modules: Generator, Verification
Classes: PickData
Class Method Summary
collapse
Instance Method Summary
collapse
included, #unsaved_uuid!, #uuid
alias_association, convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!
Methods included from Squishify
extended
Class Method Details
.default_for_verification ⇒ Object
86
87
88
|
# File 'app/models/robot.rb', line 86
def self.default_for_verification
with_verification_behaviour.first || first
end
|
.find_by_barcode(code) ⇒ Object
Also known as:
find_from_barcode
107
108
109
110
|
# File 'app/models/robot.rb', line 107
def find_by_barcode(code)
human_robot_barcode = Barcode.number_to_human(code)
Robot.find_by(barcode: human_robot_barcode) || Robot.find_by(id: human_robot_barcode)
end
|
.prefix ⇒ Object
103
104
105
|
# File 'app/models/robot.rb', line 103
def prefix
'RB'
end
|
.valid_barcode?(code) ⇒ Boolean
112
113
114
115
116
117
118
|
# File 'app/models/robot.rb', line 112
def valid_barcode?(code)
Barcode.barcode_to_human!(code, prefix)
find_from_barcode(code) true
rescue StandardError
false
end
|
Instance Method Details
#all_picks(batch) ⇒ Object
42
43
44
|
# File 'app/models/robot.rb', line 42
def all_picks(batch)
verification_behaviour.all_picks(batch, max_beds)
end
|
#generation_behaviour(generator_id) ⇒ Class
Returns the generation behaviour class for the given generator_id Looks up the RobotProperty with the give generator_id and returns the corresponding Robot::Generator class.
#generator(batch:, plate_barcode:, pick_number:, generator_id:) ⇒ Robot::Generator
Returns an instance of the generation behaviour for the given parameters.
80
81
82
83
84
|
# File 'app/models/robot.rb', line 80
def generator(batch:, plate_barcode:, pick_number:, generator_id:)
picking_data = Robot::PickData.new(batch, max_beds:).picking_data_hash(plate_barcode)[pick_number]
layout = verification_behaviour.layout_data_object(picking_data)
generation_behaviour(generator_id).new(batch:, plate_barcode:, picking_data:, layout:)
end
|
#max_beds ⇒ Object
46
47
48
|
# File 'app/models/robot.rb', line 46
def max_beds
max_plates_property.try(:value).to_i
end
|
#pick_number_to_expected_layout(batch, plate_barcode) ⇒ Object
38
39
40
|
# File 'app/models/robot.rb', line 38
def pick_number_to_expected_layout(batch, plate_barcode)
verification_behaviour.pick_number_to_expected_layout(batch, plate_barcode, max_beds)
end
|
#pick_numbers(batch, plate_barcode) ⇒ Array<String>
Note:
Added as I refactor the batches/_assets.html.erb page. Currently just wraps pick_number_to_expected_layout and as a result performs a lot of unnecessary work.
Returns an array of all pick numbers associated with the corresponding batch and plate_barcode
34
35
36
|
# File 'app/models/robot.rb', line 34
def pick_numbers(batch, plate_barcode)
verification_behaviour.pick_numbers(batch, plate_barcode, max_beds)
end
|
#verification_behaviour ⇒ Object
50
51
52
|
# File 'app/models/robot.rb', line 50
def verification_behaviour
@verification_behaviour ||= verification_class.new
end
|