mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Memoize :active in enterprise serializers that call it multiple times
This commit is contained in:
@@ -113,7 +113,7 @@ module Api
|
||||
end
|
||||
|
||||
def active
|
||||
data.active_distributor_ids.andand.include? enterprise.id
|
||||
@active ||= data.active_distributor_ids.andand.include? enterprise.id
|
||||
end
|
||||
|
||||
# Map svg icons.
|
||||
|
||||
@@ -18,7 +18,8 @@ module Api
|
||||
end
|
||||
|
||||
def active
|
||||
enterprise.ready_for_checkout? && OrderCycle.active.with_distributor(enterprise).exists?
|
||||
@active ||=
|
||||
enterprise.ready_for_checkout? && OrderCycle.active.with_distributor(enterprise).exists?
|
||||
end
|
||||
|
||||
def pickup
|
||||
|
||||
Reference in New Issue
Block a user