Class: WorkOrder

Inherits:
ApplicationRecord show all
Defined in:
app/models/work_order.rb,
app/models/work_order/factory.rb

Overview

A work order groups requests together based on submission and asset providing a unified interface for external applications. It is likely that its behaviour will be extended in future

Defined Under Namespace

Classes: Factory

Instance Method Summary collapse

Methods inherited from ApplicationRecord

alias_association, convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Squishify

extended

Instance Method Details

#at_riskObject



37
38
39
# File 'app/models/work_order.rb', line 37

def at_risk
  example_request.customer_accepts_responsibility
end

#at_risk=(risk) ⇒ Object



41
42
43
44
45
46
# File 'app/models/work_order.rb', line 41

def at_risk=(risk)
  requests.each do |request|
    request.customer_accepts_responsibility = risk
    request.save!
  end
end

#options=(new_options) ⇒ Object



48
49
50
51
52
53
# File 'app/models/work_order.rb', line 48

def options=(new_options)
  requests.each do |request|
    request. = new_options
    request.save!
  end
end

#quantity_unitsObject

Will hopefully be variable in the future



21
22
23
# File 'app/models/work_order.rb', line 21

def quantity_units
  'flowcells'
end

#quantity_valueObject



25
26
27
# File 'app/models/work_order.rb', line 25

def quantity_value
  requests.count
end

#state=(new_state) ⇒ Object



29
30
31
32
33
34
35
# File 'app/models/work_order.rb', line 29

def state=(new_state)
  super
  requests.each do |request|
    request.state = new_state
    request.save!
  end
end