Module: Spree::UserReporting

Extended by:
DisplayMoney
Included in:
UserMethods
Defined in:
app/models/concerns/spree/user_reporting.rb

Instance Method Summary (collapse)

Methods included from DisplayMoney

money_methods

Instance Method Details

- (Object) average_order_value



14
15
16
17
18
19
20
# File 'app/models/concerns/spree/user_reporting.rb', line 14

def average_order_value
  if order_count.to_i > 0
    lifetime_value / order_count
  else
    BigDecimal("0.00")
  end
end

- (Object) lifetime_value



6
7
8
# File 'app/models/concerns/spree/user_reporting.rb', line 6

def lifetime_value
  spree_orders.complete.pluck(:total).sum
end

- (Object) order_count



10
11
12
# File 'app/models/concerns/spree/user_reporting.rb', line 10

def order_count
  BigDecimal(spree_orders.complete.count)
end