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

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


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

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


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

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

#do_task(_workflows_controller, _params, _user) ⇒ Object

Raises:

  • (NotImplementedError)

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

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

#find_batch(batch_id) ⇒ Object


66
67
68
# File 'app/models/task.rb', line 66

def find_batch(batch_id)
  Batch.includes(:requests, :pipeline, :lab_events).find(batch_id)
end

#find_batch_requests(batch_id) ⇒ Object


70
71
72
# File 'app/models/task.rb', line 70

def find_batch_requests(batch_id)
  find_batch(batch_id).ordered_requests
end

#included_for_do_taskObject


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

def included_for_do_task
  %i[requests pipeline lab_events]
end

#included_for_render_taskObject


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

def included_for_render_task
  %i[requests pipeline lab_events]
end

#partialObject


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

def partial; end

#render_task(workflows_controller, params, _user) ⇒ Object


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

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