Class: WorkCompletion::LabwareCompletion
- Inherits:
-
Object
- Object
- WorkCompletion::LabwareCompletion
- Defined in:
- app/models/work_completion/labware_completion.rb
Overview
Shared behaviour of WorkCompletion::PlateCompletion and WorkCompletion::TubeCompletion
Direct Known Subclasses
Instance Attribute Summary collapse
-
#order_ids ⇒ Object
readonly
Returns the value of attribute order_ids.
-
#submission_ids ⇒ Object
readonly
Returns the value of attribute submission_ids.
-
#target_labware ⇒ Object
readonly
Returns the value of attribute target_labware.
-
#work_completion ⇒ Object
readonly
Returns the value of attribute work_completion.
Instance Method Summary collapse
-
#connect_requests ⇒ Object
Must be implemented by any subclass.
- #fire_events ⇒ Object
-
#initialize(labware, submission_ids, work_completion) ⇒ LabwareCompletion
constructor
A new instance of LabwareCompletion.
-
#pass_and_link_up_requests(target_receptacle, upstream_request) ⇒ Object
Updates the source receptacle (asset) of the downstream (normally sequencing) requests.
- #process ⇒ Object
Constructor Details
#initialize(labware, submission_ids, work_completion) ⇒ LabwareCompletion
Returns a new instance of LabwareCompletion.
10 11 12 13 14 15 |
# File 'app/models/work_completion/labware_completion.rb', line 10 def initialize(labware, submission_ids, work_completion) @target_labware = labware @submission_ids = submission_ids @order_ids = [] @work_completion = work_completion end |
Instance Attribute Details
#order_ids ⇒ Object (readonly)
Returns the value of attribute order_ids.
8 9 10 |
# File 'app/models/work_completion/labware_completion.rb', line 8 def order_ids @order_ids end |
#submission_ids ⇒ Object (readonly)
Returns the value of attribute submission_ids.
8 9 10 |
# File 'app/models/work_completion/labware_completion.rb', line 8 def submission_ids @submission_ids end |
#target_labware ⇒ Object (readonly)
Returns the value of attribute target_labware.
8 9 10 |
# File 'app/models/work_completion/labware_completion.rb', line 8 def target_labware @target_labware end |
#work_completion ⇒ Object (readonly)
Returns the value of attribute work_completion.
8 9 10 |
# File 'app/models/work_completion/labware_completion.rb', line 8 def work_completion @work_completion end |
Instance Method Details
#connect_requests ⇒ Object
Must be implemented by any subclass. Finds the relevant target receptacle(s) and the requests coming into them. Calls pass_and_link_up_requests for each of them. Implemented differently for Plates and Tubes.
26 27 28 |
# File 'app/models/work_completion/labware_completion.rb', line 26 def connect_requests raise NotImplementedError, 'abstract method' end |
#fire_events ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/models/work_completion/labware_completion.rb', line 56 def fire_events order_ids.each do |order_id| BroadcastEvent::LibraryComplete.create!( seed: work_completion, user: work_completion.user, properties: { order_id: } ) end end |
#pass_and_link_up_requests(target_receptacle, upstream_request) ⇒ Object
Updates the source receptacle (asset) of the downstream (normally sequencing) requests. Passes the requests coming into this labware’s receptacles (library requests). Collects order_ids, as these are needed to fire events.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/models/work_completion/labware_completion.rb', line 34 def pass_and_link_up_requests(target_receptacle, upstream_request) @order_ids << upstream_request.order_id # We need to find the downstream requests BEFORE connecting the upstream_request # This is because submission.next_requests tries to take a shortcut through # the target_asset if it is defined. upstream_request.next_requests.each { |ds| ds.update!(asset: target_receptacle) } # In some cases, such as the Illumina-C pipelines, requests might be # connected upfront. We don't want to touch these. upstream_request.target_asset ||= target_receptacle # We don't try and pass failed requests. # I'm not 100% convinced this decision belongs here, and instead # we may want to let the client specify wells to pass, and perform # validation to ensure this is correct. However this increases # the complexity of both the code and the interface, with only # marginal system simplification. upstream_request.pass if upstream_request.may_pass? upstream_request.save! end |
#process ⇒ Object
17 18 19 20 |
# File 'app/models/work_completion/labware_completion.rb', line 17 def process connect_requests fire_events end |