From 09bf1e74f2ec516c92f2abc718d27ea899a67067 Mon Sep 17 00:00:00 2001 From: brchristian Date: Wed, 27 Feb 2019 12:29:21 -0800 Subject: [PATCH 1/2] Remove unnecessary decimal conversion This removes an unnecessary conversion of the count of completed orders (which is always necessarily an integer!) into a decimal number. --- core/app/models/concerns/spree/user_reporting.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/app/models/concerns/spree/user_reporting.rb b/core/app/models/concerns/spree/user_reporting.rb index c111fb263f1..a31f589bc22 100644 --- a/core/app/models/concerns/spree/user_reporting.rb +++ b/core/app/models/concerns/spree/user_reporting.rb @@ -10,7 +10,7 @@ def lifetime_value end def order_count - BigDecimal(spree_orders.complete.count) + spree_orders.complete.count end def average_order_value From d2254ba1e733f71e7feb22a99844f05505e4ce30 Mon Sep 17 00:00:00 2001 From: Brian Christian Date: Fri, 1 Mar 2019 09:23:09 -0800 Subject: [PATCH 2/2] update spec not to expect BigDecimal order_count --- core/spec/models/spree/user_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/spec/models/spree/user_spec.rb b/core/spec/models/spree/user_spec.rb index 493b44cc960..e4b067cd4cc 100644 --- a/core/spec/models/spree/user_spec.rb +++ b/core/spec/models/spree/user_spec.rb @@ -142,7 +142,7 @@ def load_orders describe "#order_count" do before { load_orders } it "returns the count of completed orders for the user" do - expect(subject.order_count).to eq BigDecimal(order_count) + expect(subject.order_count).to eq order_count end end