mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Simplify orders helper
This commit is contained in:
@@ -4,16 +4,9 @@ module Admin
|
||||
#
|
||||
# We exclude shipping method adjustments because they are displayed in a
|
||||
# separate table together with the order line items.
|
||||
#
|
||||
# We also exclude tax rate adjustment with zero value.
|
||||
def order_adjustments_for_display(order)
|
||||
order.adjustments.eligible.select do |adjustment|
|
||||
type = adjustment.originator_type
|
||||
|
||||
is_shipping_method_adjustment = (type == 'Spree::ShippingMethod')
|
||||
is_zero_tax_rate_adjustment = (type == 'Spree::TaxRate' && adjustment.amount.zero?)
|
||||
|
||||
!is_shipping_method_adjustment && !is_zero_tax_rate_adjustment
|
||||
adjustment.originator_type != "Spree::ShippingMethod"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user