Memoize :active in enterprise serializers that call it multiple times

This commit is contained in:
Matt-Yorkley
2020-04-23 12:24:18 +02:00
parent 23f4faf192
commit 69cf7dff2c
2 changed files with 3 additions and 2 deletions

View File

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

View File

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