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:
Matt-Yorkley
2021-04-30 12:48:53 +01:00
parent d3f41f14c7
commit 925676f136

View File

@@ -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?