mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-02 21:57:17 +00:00
Extract method
This commit is contained in:
@@ -33,7 +33,7 @@ module Spree
|
||||
|
||||
def update_cart(params)
|
||||
if order.update_attributes(params)
|
||||
order.line_items = order.line_items.select {|li| li.quantity > 0 }
|
||||
discard_empty_line_items
|
||||
order.ensure_updated_shipments
|
||||
update_order
|
||||
true
|
||||
@@ -44,6 +44,10 @@ module Spree
|
||||
|
||||
private
|
||||
|
||||
def discard_empty_line_items
|
||||
order.line_items = order.line_items.select {|li| li.quantity.positive? }
|
||||
end
|
||||
|
||||
def update_shipment(shipment)
|
||||
shipment.present? ? shipment.update_amounts : order.ensure_updated_shipments
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user