Module: Tasks::PrepKitBarcodeHandler

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

Instance Method Summary collapse

Instance Method Details

#do_prep_kit_barcode_task(_task, params) ⇒ Object


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

def do_prep_kit_barcode_task(_task, params)
  barcode = params[:prep_kit_barcode].strip
  if barcode.blank?
    flash[:error] = 'Please enter a Kit Barcode'
    return false
  end

  requests = @batch.requests
  ActiveRecord::Base.transaction do
    requests.each do |request|
      request.target_asset.labware..update!(prep_kit_barcode: barcode)
    end
  end

  true
end

#render_prep_kit_barcode_task(task, params) ⇒ Object


2
3
# File 'app/models/tasks/prep_kit_barcode_handler.rb', line 2

def render_prep_kit_barcode_task(task, params)
end