Module: Tasks::PlatePurposeBehavior

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

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.


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

def plate_purpose_options(batch)
  requests       = batch.requests.flat_map(&:next_requests)
  plate_purposes = requests.map(&:request_type).compact.uniq.map(&:acceptable_plate_purposes).flatten.uniq
  plate_purposes = PlatePurpose.cherrypickable_as_target.all if plate_purposes.empty? # Fallback situation for the moment
  plate_purposes.map { |p| [p.name, p.size, p.id] }.sort
end