mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Move adjustment filtering from view to helper
This commit is contained in:
@@ -1,7 +1,14 @@
|
||||
module Admin
|
||||
module OrdersHelper
|
||||
def order_adjustments(order)
|
||||
order.adjustments.eligible
|
||||
order.adjustments.eligible.select do |adjustment|
|
||||
type = adjustment.originator_type
|
||||
|
||||
is_shipping_method_fee = (type == 'Spree::ShippingMethod')
|
||||
is_zero_tax_rate = (type == 'Spree::TaxRate' && adjustment.amount.zero?)
|
||||
|
||||
!is_shipping_method_fee && !is_zero_tax_rate
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
%th= Spree.t('amount')
|
||||
%tbody.with-border
|
||||
- adjustments.each do |adjustment|
|
||||
- if (adjustment.originator_type != 'Spree::ShippingMethod') && !(adjustment.originator_type == 'Spree::TaxRate' && adjustment.amount == 0)
|
||||
%tr.total
|
||||
%td.strong= adjustment.label + ":"
|
||||
%td.total.align-center
|
||||
%span= Spree::Money.new(adjustment.amount)
|
||||
%tr.total
|
||||
%td.strong= adjustment.label + ":"
|
||||
%td.total.align-center
|
||||
%span= Spree::Money.new(adjustment.amount)
|
||||
|
||||
Reference in New Issue
Block a user