Class: Billing::Factory::Sequencing
- Defined in:
- app/models/billing/factory/sequencing.rb
Overview
rubocop:todo Style/Documentation
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#aliquots ⇒ Object
Returns the value of attribute aliquots.
Attributes inherited from Base
Instance Method Summary collapse
-
#create! ⇒ Object
TODO: create should be abstracted.
-
#initialize(attributes = {}) ⇒ Sequencing
constructor
A new instance of Sequencing.
- #units(count, total) ⇒ Object
Methods inherited from Base
#billing_product_code, #billing_product_description, #passed_date, #passed_date=, #project_cost_code
Constructor Details
#initialize(attributes = {}) ⇒ Sequencing
Returns a new instance of Sequencing.
8 9 10 11 |
# File 'app/models/billing/factory/sequencing.rb', line 8 def initialize(attributes = {}) super self.aliquots = request end |
Instance Attribute Details
#aliquots ⇒ Object
Returns the value of attribute aliquots
4 5 6 |
# File 'app/models/billing/factory/sequencing.rb', line 4 def aliquots @aliquots end |
Instance Method Details
#create! ⇒ Object
TODO: create should be abstracted.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/models/billing/factory/sequencing.rb', line 20 def create! return unless valid? aliquots.count_by_project_cost_code.each do |cost_code, count| Billing::Item.create!( request: request, project_cost_code: project_cost_code(cost_code), units: units(count, aliquots.length), billing_product_code: billing_product_code, billing_product_description: billing_product_description, billing_product_name: billing_product_name, request_passed_date: passed_date ) end end |
#units(count, total) ⇒ Object
36 37 38 |
# File 'app/models/billing/factory/sequencing.rb', line 36 def units(count, total) (count.to_f / total * 100).round end |