Skip to content

Commit

Permalink
Merge pull request openfoodfoundation#12872 from mkllnk/enterprise-se…
Browse files Browse the repository at this point in the history
…rialiser

Clean up enterprise serialiser for shop page speed
  • Loading branch information
rioug authored Sep 23, 2024
2 parents 7078c4e + 318790d commit 099da3f
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions app/serializers/api/cached_enterprise_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ def distributed_product_properties
.merge(Exchange.to_enterprise(enterprise))
.select('DISTINCT spree_properties.*')

return properties.merge(OrderCycle.active) if active

properties
properties.merge(OrderCycle.active)
end

def distributed_producer_properties
Expand All @@ -106,16 +104,14 @@ def distributed_producer_properties
properties = Spree::Property
.joins(
producer_properties: {
producer: { supplied_products: { variants: { exchanges: :order_cycle } } }
producer: { supplied_variants: { exchanges: :order_cycle } }
}
)
.merge(Exchange.outgoing)
.merge(Exchange.to_enterprise(enterprise))
.select('DISTINCT spree_properties.*')

return properties.merge(OrderCycle.active) if active

properties
properties.merge(OrderCycle.active)
end

def active
Expand Down

0 comments on commit 099da3f

Please sign in to comment.