sanger/sequencescape

View on GitHub
app/models/work_completion/tube_completion.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# frozen_string_literal: true

# Class WorkCompletion::TubeCompletion provides the business logic
# for passing tubes, especially in the Limber pipelines. This has
# been pulled out of WorkCompletion itself to allow for separate behaviour
# for plates and tubes.
#
# @author Genome Research Ltd.
#
class WorkCompletion::TubeCompletion < WorkCompletion::LabwareCompletion
  def connect_requests
    detect_upstream_requests.each { |upstream| pass_and_link_up_requests(target_labware.receptacle, upstream) }
    @order_ids.uniq!
  end

  def detect_upstream_requests
    CustomerRequest.includes(WorkCompletion::REQUEST_INCLUDES).where(id: target_labware.aliquots.pluck(:request_id))
  end
end