Sha256: e5a1d504de88898db87ab101bbc84420c8ce5d95f4941467cfb93a9b9d4d600e
Contents?: true
Size: 419 Bytes
Versions: 14
Compression:
Stored size: 419 Bytes
Contents
module Spree module UserReporting extend DisplayMoney money_methods :lifetime_value, :average_order_value def lifetime_value orders.complete.pluck(:total).sum end def order_count BigDecimal(orders.complete.count) end def average_order_value if order_count.to_i > 0 lifetime_value / order_count else BigDecimal("0.00") end end end end
Version data entries
14 entries across 14 versions & 1 rubygems