Consistency in tax calculations, remove some unneeded local vars

This commit is contained in:
Rohan Mitchell
2015-03-25 16:31:15 +11:00
parent 89d4a59e9d
commit d8656a36c6
2 changed files with 3 additions and 6 deletions

View File

@@ -199,11 +199,11 @@ Spree::Order.class_eval do
end
def shipping_tax
adjustments(:reload).shipping.first.andand.included_tax || 0
adjustments(:reload).shipping.sum &:included_tax
end
def enterprise_fee_tax
adjustments(:reload).enterprise_fee.sum(&:included_tax)
adjustments(:reload).enterprise_fee.sum &:included_tax
end
def total_tax

View File

@@ -16,12 +16,9 @@ module OpenFoodNetwork
@orders.map do |order|
totals = totals_of order.line_items
shipping_cost = shipping_cost_for order
shipping_tax = order.shipping_tax
enterprise_fee_tax = order.enterprise_fee_tax
total_tax = order.total_tax
[order.number, order.created_at, totals[:items], totals[:items_total],
totals[:taxable_total], totals[:sales_tax], shipping_cost, shipping_tax, enterprise_fee_tax, total_tax,
totals[:taxable_total], totals[:sales_tax], shipping_cost, order.shipping_tax, order.enterprise_fee_tax, order.total_tax,
order.bill_address.full_name, order.distributor.andand.name]
end
end