Class: IlluminaC::StockPurpose

Inherits:
PlatePurpose
  • Object
show all
Includes:
PlatePurpose::Stock
Defined in:
app/models/illumina_c/stock_purpose.rb

Constant Summary

Constants included from PlatePurpose::Stock

PlatePurpose::Stock::READY_STATE, PlatePurpose::Stock::UNREADY_STATE

Instance Method Summary collapse

Methods included from PlatePurpose::Stock

#state_of

Instance Method Details

#transition_to(plate, state, _user, contents = nil, _customer_accepts_responsibility = false) ⇒ Object


4
5
6
7
8
9
10
11
# File 'app/models/illumina_c/stock_purpose.rb', line 4

def transition_to(plate, state, _user, contents = nil, _customer_accepts_responsibility = false)
  return unless %w[failed cancelled].include?(state)

  plate.wells.located_at(contents).include_requests_as_target.include_requests_as_source.each do |well|
    well.requests.each { |r| r.send(transition_from(r.state)) if r.is_a?(IlluminaC::Requests::LibraryRequest) && transition_from(r.state) }
    well.transfer_requests_as_target.each { |r| r.transition_to('failed') }
  end
end