Module: ExportsHelper

Defined in:
app/helpers/exports_helper.rb

Overview

Helper methods for the Exports controller

Instance Method Summary collapse

Instance Method Details

#aliquots_count_for(well) ⇒ Integer

Returns the total of all aliquots within a well

Parameters:

Returns:

  • (Integer)

    The total number of aliquots within the well



24
25
26
# File 'app/helpers/exports_helper.rb', line 24

def aliquots_count_for(well)
  well.aliquots.count
end

#each_source_metadata_for_plate(plate) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'app/helpers/exports_helper.rb', line 5

def (plate)
  plate.wells_in_columns.each do |dest_well|
    dest_well.transfer_requests_as_target.each do |transfer_req|
      # NB. Making assumption here that name field on asset is for a plate well
      # and contains a plate barcode and well location e.g. DN12345678:A1
      src_well = transfer_req.source_asset
      name_array = src_well.name.split(':')
      yield name_array[0], name_array[1], dest_well if name_array.length == 2
    end
  end
end

#mbrave_tag2_plate_num(tag_group_name) ⇒ Object



42
43
44
45
46
47
# File 'app/helpers/exports_helper.rb', line 42

def mbrave_tag2_plate_num(tag_group_name)
  unless Rails.configuration.mbrave.key?(tag_group_name.to_sym)
    raise "Tag group #{tag_group_name} was not configured for mbrave. Please contact PSD."
  end
  Rails.configuration.mbrave[tag_group_name][:num_plate]
end

#mbrave_tag_name(tag_group_name, tag_position) ⇒ Object



28
29
30
31
32
33
# File 'app/helpers/exports_helper.rb', line 28

def mbrave_tag_name(tag_group_name, tag_position)
  unless Rails.configuration.mbrave.key?(tag_group_name.to_sym)
    raise "Tag group #{tag_group_name} was not configured for mbrave. Please contact PSD."
  end
  Rails.configuration.mbrave[tag_group_name][:tags][tag_position]
end

#mbrave_tag_version(tag_group_name) ⇒ Object



35
36
37
38
39
40
# File 'app/helpers/exports_helper.rb', line 35

def mbrave_tag_version(tag_group_name)
  unless Rails.configuration.mbrave.key?(tag_group_name.to_sym)
    raise "Tag group #{tag_group_name} was not configured for mbrave. Please contact PSD."
  end
  Rails.configuration.mbrave[tag_group_name][:version]
end