Class: Spree::PromotionalCostReport::Result::Observation
- Inherits:
-
Report::TimedObservation
- Object
- Report::Observation
- Report::TimedObservation
- Spree::PromotionalCostReport::Result::Observation
- Defined in:
- app/reports/spree/promotional_cost_report.rb
Instance Attribute Summary
Attributes inherited from Report::TimedObservation
#date, #hour, #reportable_keys
Instance Method Summary collapse
- #describes?(result, time_scale) ⇒ Boolean
- #promotion_discount ⇒ Object
- #promotion_end_date ⇒ Object
- #promotion_start_date ⇒ Object
Methods inherited from Report::TimedObservation
#day_name, #hour_name, #initialize, #month_name, #to_h
Methods inherited from Report::Observation
build_from_hash, build_from_list, #initialize, observation_fields, #to_h
Constructor Details
This class inherits a constructor from Spree::Report::TimedObservation
Instance Method Details
#describes?(result, time_scale) ⇒ Boolean
43 44 45 |
# File 'app/reports/spree/promotional_cost_report.rb', line 43 def describes?(result, time_scale) result['promotion_name'] == promotion_name && super end |
#promotion_discount ⇒ Object
39 40 41 |
# File 'app/reports/spree/promotional_cost_report.rb', line 39 def promotion_discount @promotion_discount.to_f.abs end |
#promotion_end_date ⇒ Object
35 36 37 |
# File 'app/reports/spree/promotional_cost_report.rb', line 35 def promotion_end_date @promotion_end_date.present? ? @promotion_end_date.to_date.strftime("%B %d %Y") : "-" end |
#promotion_start_date ⇒ Object
31 32 33 |
# File 'app/reports/spree/promotional_cost_report.rb', line 31 def promotion_start_date @promotion_start_date.present? ? @promotion_start_date.to_date.strftime("%B %d %Y") : "-" end |