mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-27 06:05:19 +00:00
Fetch order cycle variants in SQL
This commit is contained in:
@@ -132,7 +132,11 @@ class OrderCycle < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def variants
|
||||
self.exchanges.map(&:variants).flatten.uniq.reject(&:deleted?)
|
||||
Spree::Variant.
|
||||
joins(:exchanges).
|
||||
merge(Exchange.in_order_cycle(self)).
|
||||
not_deleted.
|
||||
select('DISTINCT spree_variants.*')
|
||||
end
|
||||
|
||||
def distributed_variants
|
||||
|
||||
Reference in New Issue
Block a user