Class: Pipeline::GrouperForPipeline

Inherits:
Object
  • Object
show all
Defined in:
app/models/pipeline/grouper_for_pipeline.rb

Overview

Some pipelines group requests together in the inbox, such that all requests in a submission or plate MUST be selected together This takes the selected checkboxes and splits the information back out to the individual requests.

Instance Method Summary collapse

Constructor Details

#initialize(pipeline) ⇒ GrouperForPipeline

Returns a new instance of GrouperForPipeline


20
21
22
# File 'app/models/pipeline/grouper_for_pipeline.rb', line 20

def initialize(pipeline)
  @pipeline = pipeline
end

Instance Method Details

#all(selected_groups) ⇒ Object


31
32
33
34
# File 'app/models/pipeline/grouper_for_pipeline.rb', line 31

def all(selected_groups)
  selected_groups.map { |group| extract_conditions(group) }
                 .reduce { |scope, query| scope.or(query) }
end

#base_scopeObject


24
25
26
27
28
29
# File 'app/models/pipeline/grouper_for_pipeline.rb', line 24

def base_scope
  requests.order(:id)
          .ready_in_storage
          .full_inbox
          .select('requests.*')
end