Class: PassesReport::Row
- Inherits:
-
Object
- Object
- PassesReport::Row
- Defined in:
- app/models/passes_report.rb
Instance Attribute Summary collapse
-
#discounted ⇒ Object
Returns the value of attribute discounted.
-
#gross ⇒ Object
Returns the value of attribute gross.
-
#order ⇒ Object
Returns the value of attribute order.
-
#original_price ⇒ Object
Returns the value of attribute original_price.
-
#pass_type ⇒ Object
Returns the value of attribute pass_type.
-
#show ⇒ Object
Returns the value of attribute show.
-
#ticket_count ⇒ Object
Returns the value of attribute ticket_count.
Instance Method Summary collapse
-
#initialize(order) ⇒ Row
constructor
A new instance of Row.
Constructor Details
#initialize(order) ⇒ Row
Returns a new instance of Row.
91 92 93 94 95 96 97 98 99 100 |
# File 'app/models/passes_report.rb', line 91 def initialize(order) self.order = order self.pass_type = order.pass_codes.first.pass_type.name self.show = order.items_that_used_pass.first.show self.original_price = order.items_that_used_pass.inject(0) { |total, item| total + item.original_price } self.gross = order.items_that_used_pass.inject(0) { |total, item| total + item.price } self.discounted = self.original_price - self.gross self.ticket_count = order.items_that_used_pass.length self.ticket_count = self.ticket_count * -1 if !order.items_that_used_pass.select(&:refund?).empty? end |
Instance Attribute Details
#discounted ⇒ Object
Returns the value of attribute discounted.
89 90 91 |
# File 'app/models/passes_report.rb', line 89 def discounted @discounted end |
#gross ⇒ Object
Returns the value of attribute gross.
89 90 91 |
# File 'app/models/passes_report.rb', line 89 def gross @gross end |
#order ⇒ Object
Returns the value of attribute order.
89 90 91 |
# File 'app/models/passes_report.rb', line 89 def order @order end |
#original_price ⇒ Object
Returns the value of attribute original_price.
89 90 91 |
# File 'app/models/passes_report.rb', line 89 def original_price @original_price end |
#pass_type ⇒ Object
Returns the value of attribute pass_type.
89 90 91 |
# File 'app/models/passes_report.rb', line 89 def pass_type @pass_type end |
#show ⇒ Object
Returns the value of attribute show.
89 90 91 |
# File 'app/models/passes_report.rb', line 89 def show @show end |
#ticket_count ⇒ Object
Returns the value of attribute ticket_count.
89 90 91 |
# File 'app/models/passes_report.rb', line 89 def ticket_count @ticket_count end |