Class: FluidigmTemplateTask

Inherits:
PlateTemplateTask show all
Defined in:
app/models/fluidigm_template_task.rb

Overview

rubocop:todo Style/Documentation

Instance Method Summary collapse

Methods inherited from PlateTemplateTask

#do_task, #render_task

Methods inherited from Task

#can_link_directly?, #can_process?, #do_task, #find_batch, #find_batch_requests, #included_for_do_task, #included_for_render_task, #render_task

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

#partialObject


3
4
5
# File 'app/models/fluidigm_template_task.rb', line 3

def partial
  'fluidigm_template_batches'
end

#plate_purpose_options(batch) ⇒ Object

rubocop:todo Metrics/AbcSize


7
8
9
10
11
12
13
14
15
# File 'app/models/fluidigm_template_task.rb', line 7

def plate_purpose_options(batch) # rubocop:todo Metrics/AbcSize
  next_requests = batch.requests.flat_map(&:next_requests)
  plate_purposes = next_requests.filter_map(&:request_type).uniq.map(&:acceptable_plate_purposes).flatten.uniq

  # If downstream requests don't specify an acceptable_plate_purpose, fallback to any target purposes
  # on the current requests
  plate_purposes = batch.requests.filter_map { |r| r..target_purpose }.uniq if plate_purposes.empty?
  plate_purposes.map { |p| [p.name, p.size, p.id] }.sort
end