mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Split Order::Updater#update into two methods
There are two distinct (and very important) operations happening here. The first is to update all adjustments (which can be *incredibly* expensive) and the second is to ensure the order's totals and shipping/payment states are correct. There are lots of places where we currently do both of these things where in fact we only need to do the latter (and skip the really expensive part).
This commit is contained in:
@@ -20,6 +20,10 @@ module OrderManagement
|
||||
# associations try to save and then in turn try to call +update!+ again.)
|
||||
def update
|
||||
update_all_adjustments
|
||||
update_totals_and_states
|
||||
end
|
||||
|
||||
def update_totals_and_states
|
||||
update_totals
|
||||
|
||||
if order.completed?
|
||||
|
||||
Reference in New Issue
Block a user