Class: StateChangers::AutomaticLabwareStateChanger
- Inherits:
-
DefaultStateChanger
- Object
- DefaultStateChanger
- StateChangers::AutomaticLabwareStateChanger
- Defined in:
- app/models/state_changers.rb
Overview
Plate state changer to automatically complete specified work requests. This is the abstract version.
Direct Known Subclasses
Instance Method Summary collapse
-
#complete_outstanding_requests ⇒ Object
rubocop:enable Style/OptionalBooleanParameter.
-
#move_to!(state, reason = nil, customer_accepts_responsibility = false) ⇒ Object
rubocop:todo Style/OptionalBooleanParameter.
- #purpose_config ⇒ Object
- #purpose_uuid ⇒ Object
- #v2_labware ⇒ Object
- #work_completion_request_type ⇒ Object
Constructor Details
This class inherits a constructor from StateChangers::DefaultStateChanger
Instance Method Details
#complete_outstanding_requests ⇒ Object
rubocop:enable Style/OptionalBooleanParameter
98 99 100 101 102 103 104 |
# File 'app/models/state_changers.rb', line 98 def complete_outstanding_requests in_prog_submissions = v2_labware.in_progress_submission_uuids(request_type_to_complete: work_completion_request_type) return if in_prog_submissions.blank? api.work_completion.create!(submissions: in_prog_submissions, target: v2_labware.uuid, user: user_uuid) end |
#move_to!(state, reason = nil, customer_accepts_responsibility = false) ⇒ Object
rubocop:todo Style/OptionalBooleanParameter
91 92 93 94 |
# File 'app/models/state_changers.rb', line 91 def move_to!(state, reason = nil, customer_accepts_responsibility = false) super complete_outstanding_requests end |
#purpose_config ⇒ Object
82 83 84 |
# File 'app/models/state_changers.rb', line 82 def purpose_config @purpose_config ||= Settings.purposes[purpose_uuid] end |
#purpose_uuid ⇒ Object
78 79 80 |
# File 'app/models/state_changers.rb', line 78 def purpose_uuid @purpose_uuid ||= v2_labware.purpose.uuid end |
#v2_labware ⇒ Object
74 75 76 |
# File 'app/models/state_changers.rb', line 74 def v2_labware raise 'Must be implemented on subclass' end |
#work_completion_request_type ⇒ Object
86 87 88 |
# File 'app/models/state_changers.rb', line 86 def work_completion_request_type @work_completion_request_type ||= purpose_config[:work_completion_request_type] end |