Class: WorkCompletion::PlateCompletion
- Inherits:
-
LabwareCompletion
- Object
- LabwareCompletion
- WorkCompletion::PlateCompletion
- Defined in:
- app/models/work_completion/plate_completion.rb
Overview
Class WorkCompletion::PlateCompletion provides the business logic for passing plates, especially in the Limber pipelines. This has been pulled out of WorkCompletion itself to allow for separate behaviour for plates and tubes.
Instance Attribute Summary
Attributes inherited from LabwareCompletion
#order_ids, #submission_ids, #target_labware, #work_completion
Instance Method Summary collapse
- #connect_requests ⇒ Object
- #detect_upstream_requests(target_well) ⇒ Object
- #process ⇒ Object
- #target_wells ⇒ Object
-
#update_stock_wells ⇒ Object
The wells on this plate are now considered the ‘stock wells’ of any downstream of them.
Methods inherited from LabwareCompletion
#fire_events, #initialize, #pass_and_link_up_requests
Constructor Details
This class inherits a constructor from WorkCompletion::LabwareCompletion
Instance Method Details
#connect_requests ⇒ Object
16 17 18 19 20 21 |
# File 'app/models/work_completion/plate_completion.rb', line 16 def connect_requests target_wells.each do |target_well| detect_upstream_requests(target_well).each { |upstream| pass_and_link_up_requests(target_well, upstream) } end @order_ids.uniq! end |
#detect_upstream_requests(target_well) ⇒ Object
32 33 34 |
# File 'app/models/work_completion/plate_completion.rb', line 32 def detect_upstream_requests(target_well) target_well.aliquots.map(&:request) end |
#process ⇒ Object
11 12 13 14 |
# File 'app/models/work_completion/plate_completion.rb', line 11 def process super update_stock_wells end |
#target_wells ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'app/models/work_completion/plate_completion.rb', line 23 def target_wells @target_wells ||= target_labware .wells .includes(aliquots: { request: WorkCompletion::REQUEST_INCLUDES }) .include_stock_wells_for_modification .where(requests: { submission_id: submission_ids }) end |
#update_stock_wells ⇒ Object
The wells on this plate are now considered the ‘stock wells’ of any downstream of them.
37 38 39 40 |
# File 'app/models/work_completion/plate_completion.rb', line 37 def update_stock_wells Well::Link.stock.where(target_well_id: target_wells.map(&:id)).delete_all Well::Link.stock.import(target_wells.map { |well| { source_well_id: well.id, target_well_id: well.id } }) end |