Module: SearchHelper

Defined in:
app/helpers/search_helper.rb

Overview

rubocop:todo Style/Documentation

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.alternative_workline_reference_name(labware) ⇒ Object



21
22
23
24
25
26
# File 'app/helpers/search_helper.rb', line 21

def self.alternative_workline_reference_name(labware)
  conf = purpose_config_for_purpose_name(labware.purpose_name)
  return nil if conf.nil?

  conf[:alternative_workline_identifier]
end

.merger_plate_namesObject



28
29
30
# File 'app/helpers/search_helper.rb', line 28

def self.merger_plate_names
  Settings.purposes.values.select(&:merger_plate).map(&:name)
end

.purpose_config_for_purpose_name(purpose_name) ⇒ Object



17
18
19
# File 'app/helpers/search_helper.rb', line 17

def self.purpose_config_for_purpose_name(purpose_name)
  Settings.purposes.values.find { |obj| obj[:name] == purpose_name }
end

.stock_plate_namesObject



8
9
10
# File 'app/helpers/search_helper.rb', line 8

def self.stock_plate_names
  Settings.purposes.values.select(&:input_plate).map(&:name)
end

.stock_plate_names_with_flagObject

Returns purpose names of stock plates using stock_plate flag instead of input_plate.



13
14
15
# File 'app/helpers/search_helper.rb', line 13

def self.stock_plate_names_with_flag
  Settings.purposes.values.select(&:stock_plate).map(&:name)
end

Instance Method Details

#purpose_options(type) ⇒ Object



32
33
34
35
36
37
# File 'app/helpers/search_helper.rb', line 32

def purpose_options(type)
  Settings
    .purposes
    .select { |_uuid, settings| settings[:asset_type] == type }
    .map { |uuid, settings| [settings[:name], uuid] }
end

#stock_plate_uuidsObject



4
5
6
# File 'app/helpers/search_helper.rb', line 4

def stock_plate_uuids
  Settings.purposes.select { |_uuid, config| config.input_plate }.keys
end