Class: Task Deprecated

Inherits:
ApplicationRecord show all
Defined in:
app/models/task.rb

Overview

Deprecated.

Task form a large number of legacy pipelines in Sequencescape, however most

Note:

A large number of tasks delegate a large portion of their behaviour back to the

A Task forms part of a Workflow which in turn describes the steps that form a Pipeline. Most tasks are a subclass of Task

more recent pipelines exist outside of Sequencescape itself.

Tasks have three key methods #render_task: Which handles rendering the form displayed to the user #do_task: Which takes the parameters from the form, and performs the task in question #partial: Inicates which partial to render when displaying the form.

WorkflowsController. This behaviour is mostly defined in modules under Task.

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

Indicates if a task can be linked to directly from the batch show page For most tasks this dependent on whether the task can be performed, but some tasks are dependent on the previous task, or are even directly coupled to it.

Parameters:

  • batch (Batch)

    The batch on which the action will be performed

Returns:

  • (Array<Bool,String>)

    Array indicating if the action can be performed. Second element is a message about why the action is prevented



47
48
49
# File 'app/models/task.rb', line 47

def can_link_directly?(batch)
  can_process?(batch)
end

#can_process?(batch) ⇒ Array<Bool,String>

Indicates if a task can be performed. By default, most tasks will only support unreleased batches

Parameters:

  • batch (Batch)

    The batch on which the action will be performed

Returns:

  • (Array<Bool,String>)

    Array indicating if the action can be performed. Second element is a message about why the action is prevented



33
34
35
# File 'app/models/task.rb', line 33

def can_process?(batch)
  batch.released? ? [false, 'Disabled on released batches'] : [true, nil]
end

#do_task(_workflows_controller, _params, _user) ⇒ Object

Raises:

  • (NotImplementedError)


63
64
65
# File 'app/models/task.rb', line 63

def do_task(_workflows_controller, _params, _user)
  raise NotImplementedError, "Please Implement a do_task for #{self.class.name}"
end

#included_for_do_taskObject



51
52
53
# File 'app/models/task.rb', line 51

def included_for_do_task
  %i[requests pipeline lab_events]
end

#included_for_render_taskObject



55
56
57
# File 'app/models/task.rb', line 55

def included_for_render_task
  %i[requests pipeline lab_events]
end

#partialObject



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

def partial
end

#render_task(workflows_controller, params, _user) ⇒ Object



59
60
61
# File 'app/models/task.rb', line 59

def render_task(workflows_controller, params, _user)
  workflows_controller.render_task(self, params)
end