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
68
69
70
|
# File 'app/models/robot.rb', line 68
def self.default_for_verification
with_verification_behaviour.first || first
end
|
.find_by_barcode(code) ⇒ Object
Also known as:
find_from_barcode
89
90
91
92
|
# File 'app/models/robot.rb', line 89
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
85
86
87
|
# File 'app/models/robot.rb', line 85
def prefix
'RB'
end
|
.valid_barcode?(code) ⇒ Boolean
94
95
96
97
98
99
100
|
# File 'app/models/robot.rb', line 94
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
41
42
43
|
# File 'app/models/robot.rb', line 41
def all_picks(batch)
verification_behaviour.all_picks(batch, max_beds)
end
|
#generation_behaviour ⇒ Object
#generator(batch:, plate_barcode:, pick_number:) ⇒ Object
62
63
64
65
66
|
# File 'app/models/robot.rb', line 62
def generator(batch:, plate_barcode:, pick_number:)
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.new(batch:, plate_barcode:, picking_data:, layout:)
end
|
#max_beds ⇒ Object
45
46
47
|
# File 'app/models/robot.rb', line 45
def max_beds
max_plates_property.try(:value).to_i
end
|
#pick_number_to_expected_layout(batch, plate_barcode) ⇒ Object
37
38
39
|
# File 'app/models/robot.rb', line 37
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
33
34
35
|
# File 'app/models/robot.rb', line 33
def pick_numbers(batch, plate_barcode)
verification_behaviour.pick_numbers(batch, plate_barcode, max_beds)
end
|
#verification_behaviour ⇒ Object
49
50
51
|
# File 'app/models/robot.rb', line 49
def verification_behaviour
@verification_behaviour ||= verification_class.new
end
|