mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Memoize OrderBalance instance
There's no need to create an instance of such class for every call to one of its methods. The balance is computed each time anyway, so it'll always be up-to-date.
This commit is contained in:
@@ -9,7 +9,7 @@ module Balance
|
||||
|
||||
# Branches by the OrderBalance abstraction
|
||||
def outstanding_balance
|
||||
OrderBalance.new(self)
|
||||
@order_balance ||= OrderBalance.new(self)
|
||||
end
|
||||
|
||||
# Returns the order balance by considering the total as money owed to the order distributor aka.
|
||||
|
||||
Reference in New Issue
Block a user