From 55db911334587dbb84cc7ace5fa85aa90733c0a5 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Sun, 14 Feb 2021 16:26:50 +0000 Subject: [PATCH] Update sales tax report --- lib/open_food_network/sales_tax_report.rb | 3 +-- spec/lib/open_food_network/sales_tax_report_spec.rb | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/open_food_network/sales_tax_report.rb b/lib/open_food_network/sales_tax_report.rb index d7a8863b28..8abce8c0e4 100644 --- a/lib/open_food_network/sales_tax_report.rb +++ b/lib/open_food_network/sales_tax_report.rb @@ -96,8 +96,7 @@ module OpenFoodNetwork end def shipping_cost_for(order) - shipping_cost = order.adjustments.find_by(label: "Shipping").andand.amount - shipping_cost.nil? ? 0.0 : shipping_cost + order.shipments.first&.cost || 0.0 end def tax_included_in(line_item) diff --git a/spec/lib/open_food_network/sales_tax_report_spec.rb b/spec/lib/open_food_network/sales_tax_report_spec.rb index 088f3ba47c..72c68d5c05 100644 --- a/spec/lib/open_food_network/sales_tax_report_spec.rb +++ b/spec/lib/open_food_network/sales_tax_report_spec.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require 'spec_helper' require 'open_food_network/sales_tax_report' module OpenFoodNetwork