Class: UatActions::GenerateSpikedBufferTube
- Inherits:
-
UatActions
- Object
- UatActions
- UatActions::GenerateSpikedBufferTube
- Defined in:
- app/uat_actions/uat_actions/generate_spiked_buffer_tube.rb
Overview
Will construct a SpikedBuffer tube (contains PhiX control sample)
Constant Summary
Constants inherited from UatActions
Class Method Summary collapse
-
.default ⇒ UatActions::GenerateSpikedBufferTube
Returns a default copy of the UatAction which will be used to fill in the form.
Instance Method Summary collapse
- #create_phix_stocks(timestamp) ⇒ Object
- #create_spiked_buffers(timestamp, parent_stocks) ⇒ Object
-
#perform ⇒ Boolean
[perform description].
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 ⇒ UatActions::GenerateSpikedBufferTube
Returns a default copy of the UatAction which will be used to fill in the form
24 25 26 |
# File 'app/uat_actions/uat_actions/generate_spiked_buffer_tube.rb', line 24 def self.default new(tube_count: 1) end |
Instance Method Details
#create_phix_stocks(timestamp) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/uat_actions/uat_actions/generate_spiked_buffer_tube.rb', line 48 def create_phix_stocks() phi_x_stock_params = { name: "uat-phix-stock-#{}", tags: 'Dual', concentration: 10, number: 1, study_id: PhiX.default_study_option&.id } parent_stock = PhiX::Stock.new(phi_x_stock_params) return nil unless parent_stock.save parent_stock.created_stocks end |
#create_spiked_buffers(timestamp, parent_stocks) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'app/uat_actions/uat_actions/generate_spiked_buffer_tube.rb', line 62 def create_spiked_buffers(, parent_stocks) phi_x_spiked_buffers_params = { name: "uat-phix-spikedbuffer-#{}", parent_barcode: parent_stocks.first., concentration: 10, number: tube_count, volume: 10 } spiked_buffer = PhiX::SpikedBuffer.new(phi_x_spiked_buffers_params) return nil unless spiked_buffer.save spiked_buffer.created_spiked_buffers end |
#perform ⇒ Boolean
[perform description]
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/uat_actions/uat_actions/generate_spiked_buffer_tube.rb', line 32 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 = Time.now.to_i parent_stocks = create_phix_stocks() return false unless parent_stocks spiked_buffers = create_spiked_buffers(, parent_stocks) return false unless spiked_buffers spiked_buffers.each_with_index { |tube, index| report["tube_#{index}"] = tube. } true end |