mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
Memoize #active_outgoing_variants result
This commit is contained in:
@@ -235,11 +235,13 @@ module OpenFoodNetwork
|
||||
end
|
||||
|
||||
def active_outgoing_variants(hub)
|
||||
active_variants = []
|
||||
@order_cycle.exchanges.outgoing.where(receiver_id: hub).limit(1).each do |exchange|
|
||||
active_variants = exchange.variants
|
||||
@active_outgoing_variants ||= begin
|
||||
active_variants = []
|
||||
@order_cycle.exchanges.outgoing.where(receiver_id: hub).limit(1).each do |exchange|
|
||||
active_variants = exchange.variants
|
||||
end
|
||||
active_variants
|
||||
end
|
||||
active_variants
|
||||
end
|
||||
|
||||
def user_manages_coordinator_or(enterprise)
|
||||
|
||||
Reference in New Issue
Block a user