Class: UatActions::GenerateTubes
- Inherits:
-
UatActions
- Object
- UatActions
- UatActions::GenerateTubes
- Defined in:
- app/uat_actions/uat_actions/generate_tubes.rb
Overview
Will construct sample tubes filled with samples
Constant Summary
Constants inherited from UatActions
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from UatActions
all, category, find, form_field, form_fields, #form_fields, grouped_and_sorted_uat_actions, id, inherited, permitted, #report, #save, to_partial_path, uat_actions
Class Method Details
.default ⇒ Object
33 34 35 |
# File 'app/uat_actions/uat_actions/generate_tubes.rb', line 33 def self.default new(tube_count: 1, study_name: UatActions::StaticRecords.study.name) end |
Instance Method Details
#perform ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/uat_actions/uat_actions/generate_tubes.rb', line 37 def perform tube_count.to_i.times do |i| tube = tube_purpose.create! sample_name = "sample_#{tube.}_#{i}" tube.aliquots.create!( sample: Sample.create!( name: sample_name, sanger_sample_id: sample_name, studies: [study], sample_metadata_attributes: { supplier_name: sample_name } ), study: study ) (tube) # set the tube primary barcode on the report report["tube_#{i}"] = tube. end true end |