From b879ea5a968d1bf0e3c31e0fa2d9f85354d69959 Mon Sep 17 00:00:00 2001 From: Pierre de Lacroix Date: Mon, 15 May 2017 09:03:59 +0200 Subject: [PATCH] add comments --- app/models/spree/adjustment_decorator.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/models/spree/adjustment_decorator.rb b/app/models/spree/adjustment_decorator.rb index 255f3de51a..035398d332 100644 --- a/app/models/spree/adjustment_decorator.rb +++ b/app/models/spree/adjustment_decorator.rb @@ -34,6 +34,7 @@ module Spree included_tax > 0 end + # @return [Array] def tax_rates case originator when Spree::TaxRate @@ -51,6 +52,9 @@ module Spree end end + # shipping fees and adjustments created from the admin panel have + # taxes set at creation in the included_tax field without relation + # to the corresponding TaxRate, so we look for the closest one def find_closest_tax_rates_from_included_tax approximation = (included_tax / (amount - included_tax)) return [] if approximation.infinite? or approximation.zero?