Extract method

This commit is contained in:
Matt-Yorkley
2021-02-07 13:22:26 +00:00
parent 89889bc280
commit 9bbe57afda

View File

@@ -17,9 +17,6 @@ module Spree
end
def update_adjustments
tax_adjustments =
(item.respond_to?(:all_adjustments) ? item.all_adjustments : item.adjustments).tax
adjustment_total = adjustments.additional.map(&:update!).compact.sum
included_tax_total = tax_adjustments.inclusive.reload.map(&:update!).compact.sum
additional_tax_total = tax_adjustments.additional.reload.map(&:update!).compact.sum
@@ -31,5 +28,11 @@ module Spree
updated_at: Time.zone.now
)
end
private
def tax_adjustments
(item.respond_to?(:all_adjustments) ? item.all_adjustments : item.adjustments).tax
end
end
end