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

convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Squishify

extended

Methods included from Warren::BroadcastMessages

#broadcast, included, #queue_associated_for_broadcast, #queue_for_broadcast, #warren

Instance Method Details

#at_riskObject


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

def at_risk
  example_request.customer_accepts_responsibility
end

#at_risk=(risk) ⇒ Object


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

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

#options=(new_options) ⇒ Object


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

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

#quantity_unitsObject

Will hopefully be variable in the future


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

def quantity_units
  'flowcells'
end

#quantity_valueObject


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

def quantity_value
  requests.count
end

#state=(new_state) ⇒ Object


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

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