Module: Tasks::AddSpikedInControlHandler

Included in:
WorkflowsController
Defined in:
app/models/tasks/add_spiked_in_control_handler.rb

Overview

Handles the behaviour of AddSpikedInControlTask and included in WorkflowsController A Task used in the sequencing pipelines. Associates a tube of SpikedBuffer with a Lane indicating that PhiX has been added to the lane in question.

Instance Method Summary collapse

Instance Method Details

#do_add_spiked_in_control_task(task, params) ⇒ Object


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/models/tasks/add_spiked_in_control_handler.rb', line 4

def do_add_spiked_in_control_task(task, params)
  batch = @batch || Batch.find(params[:batch_id])
  barcode = params[:barcode].first
  control = SpikedBuffer.find_by_barcode(barcode)
  request_id_set = Set.new
  params[:request].each do |k, v|
    request_id_set << k.to_i if v == 'on'
  end

  unless control
    flash[:error] = "Can't find a spiked hybridization buffer with barcode #{barcode}"
    return false
  end

  Batch.transaction do
    task.add_control(batch, control, request_id_set)
    eventify_batch(batch, task)
  end
end