Class: Spree::AdvancedReport::IncrementReport::Count
- Inherits:
-
Spree::AdvancedReport::IncrementReport
- Object
- Spree::AdvancedReport
- Spree::AdvancedReport::IncrementReport
- Spree::AdvancedReport::IncrementReport::Count
- Defined in:
- lib/spree/advanced_report/increment_report/count.rb
Constant Summary
Constants inherited from Spree::AdvancedReport::IncrementReport
Instance Attribute Summary
Attributes inherited from Spree::AdvancedReport::IncrementReport
#all_data, #dates, #increments, #total
Attributes inherited from Spree::AdvancedReport
#data, #date_text, #orders, #params, #product, #product_in_taxon, #product_text, #ruportdata, #search, #taxon, #taxon_text, #unfiltered_params
Instance Method Summary collapse
- #column ⇒ Object
- #description ⇒ Object
-
#initialize(params) ⇒ Count
constructor
A new instance of Count.
- #name ⇒ Object
Methods inherited from Spree::AdvancedReport::IncrementReport
#format_total, #generate_ruport_data, #get_bucket, #get_display
Methods inherited from Spree::AdvancedReport
#date_range, #download_url, #order_count, #profit, #revenue, #units
Constructor Details
#initialize(params) ⇒ Count
Returns a new instance of Count.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/spree/advanced_report/increment_report/count.rb', line 14 def initialize(params) super(params) self.total = 0 self.orders.each do |order| date = {} INCREMENTS.each do |type| date[type] = get_bucket(type, order.completed_at) data[type][date[type]] ||= { :value => 0, :display => get_display(type, order.completed_at), } end order_count = order_count(order) INCREMENTS.each { |type| data[type][date[type]][:value] += order_count } self.total += order_count end generate_ruport_data end |
Instance Method Details
#column ⇒ Object
6 7 8 |
# File 'lib/spree/advanced_report/increment_report/count.rb', line 6 def column I18n.t("adv_report.increment_report.count.column") end |
#description ⇒ Object
10 11 12 |
# File 'lib/spree/advanced_report/increment_report/count.rb', line 10 def description I18n.t("adv_report.increment_report.count.description") end |
#name ⇒ Object
2 3 4 |
# File 'lib/spree/advanced_report/increment_report/count.rb', line 2 def name I18n.t("adv_report.increment_report.count.name") end |