Class: UatActions::GenerateTagGroup

Inherits:
UatActions show all
Defined in:
app/uat_actions/uat_actions/generate_tag_group.rb

Overview

Will construct plates with well_count wells filled with samples

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from UatActions

all, find, form_field, form_fields, #form_fields, id, inherited, permitted, #report, #save, to_partial_path, uat_actions

Class Method Details

.defaultUatActions::GenerateTagGroup

Returns a default copy of the UatAction which will be used to fill in the form

Returns:


31
32
33
# File 'app/uat_actions/uat_actions/generate_tag_group.rb', line 31

def self.default
  new(size: 384)
end

Instance Method Details

#existing_tagsObject


51
52
53
# File 'app/uat_actions/uat_actions/generate_tag_group.rb', line 51

def existing_tags
  @tag_group.tags.count
end

#performBoolean

perform description

Returns:

  • (Boolean)

    Returns true if the action was successful, false otherwise


39
40
41
42
43
44
45
46
47
48
49
# File 'app/uat_actions/uat_actions/generate_tag_group.rb', line 39

def perform
  # Called by the controller once the form is filled in. Add your actual actions here.
  # All the form fields are accessible as simple attributes.
  # Return true if everything works
  report[:name] = name
  return true if existing_tag_group

  tag_group = TagGroup.create!(name: name)
  tag_group.tags.build(OligoEnumerator.new(size.to_i).each_with_index.map { |oligo, map_id| { oligo: oligo, map_id: map_id + 1 } })
  tag_group.save
end