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 Warren::BroadcastMessages

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

Instance Method Details

#at_riskObject


34
35
36
# File 'app/models/work_order.rb', line 34

def at_risk
  example_request.customer_accepts_responsibility
end

#at_risk=(risk) ⇒ Object


38
39
40
41
42
43
# File 'app/models/work_order.rb', line 38

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

#options=(new_options) ⇒ Object


45
46
47
48
49
50
# File 'app/models/work_order.rb', line 45

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

#quantity_unitsObject

Will hopefully be variable in the future


18
19
20
# File 'app/models/work_order.rb', line 18

def quantity_units
  'flowcells'
end

#quantity_valueObject


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

def quantity_value
  requests.count
end

#state=(new_state) ⇒ Object


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

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