Do not show zero fees

This commit is contained in:
Rohan Mitchell
2014-07-31 15:36:13 +10:00
parent 647495465a
commit 494b572c69
2 changed files with 7 additions and 1 deletions

View File

@@ -19,7 +19,7 @@ module OpenFoodNetwork
fees[applicator.enterprise_fee.fee_type.to_sym] ||= 0
fees[applicator.enterprise_fee.fee_type.to_sym] += calculate_fee_for variant, applicator
fees
end
end.select { |fee_type, amount| amount > 0 }
end

View File

@@ -45,6 +45,12 @@ module OpenFoodNetwork
it "returns a breakdown of fees" do
EnterpriseFeeCalculator.new(distributor, order_cycle).fees_by_type_for(product.master).should == {admin: 1.23, sales: 4.56, packing: 7.89, transport: 0.12}
end
it "filters out zero fees" do
ef_admin.calculator.update_attribute :preferred_amount, 0
EnterpriseFeeCalculator.new(distributor, order_cycle).fees_by_type_for(product.master).should == {sales: 4.56, packing: 7.89, transport: 0.12}
end
end
describe "creating adjustments" do