Sha256: 1c6a45469cd4568f2a2281cae8d06081e60258b3fbc9d80e9cf27c263f701c6a

Contents?: true

Size: 836 Bytes

Versions: 1

Compression:

Stored size: 836 Bytes

Contents

class Spree::AdvancedReport::IncrementReport::Units < Spree::AdvancedReport::IncrementReport
  def name
    I18n.t("adv_report.increment_report.units.name")
  end

  def column
    I18n.t("adv_report.increment_report.units.column")
  end

  def description
    I18n.t("adv_report.increment_report.units.description")
  end

  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
      units = units(order)
      INCREMENTS.each { |type| data[type][date[type]][:value] += units }
      self.total += units
    end

    generate_ruport_data
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_advanced_reporting-2.1.0 lib/spree/advanced_report/increment_report/units.rb