Module: Tasks::PlatePurposeBehavior

Included in:
MultiplexedCherrypickingTask, PlateTemplateTask
Defined in:
app/models/tasks/plate_purpose_behavior.rb

Overview

rubocop:todo Style/Documentation

Instance Method Summary collapse

Instance Method Details

#plate_purpose_options(batch) ⇒ Object

Returns a list of valid plate purpose types based on the requests in the current batch.


5
6
7
8
9
10
11
12
# File 'app/models/tasks/plate_purpose_behavior.rb', line 5

def plate_purpose_options(batch)
  requests = batch.requests.flat_map(&:next_requests)
  plate_purposes = requests.filter_map(&:request_type).uniq.map(&:acceptable_plate_purposes).flatten.uniq

  # Fallback situation for the moment
  plate_purposes = PlatePurpose.cherrypickable_as_target.all if plate_purposes.empty?
  plate_purposes.map { |p| [p.name, p.size, p.id] }.sort
end