mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-12 23:27:48 +00:00
Refactor #products_relation
Due to primary_taxon and supplier having moved to the variant, filtering by_producer and by_category with a custom order involves some complicated sql queries. So we moved the sorting logic from ProductsRenderer to OrderCycles::DistributedProductsService so we can keep the complicated SQL logic contained in one place
This commit is contained in:
committed by
zanetagebka
parent
4819fb6f62
commit
2bac76ff40
@@ -71,8 +71,8 @@ module OrderCycles
|
||||
distributor.preferred_shopfront_product_sorting_method
|
||||
end
|
||||
|
||||
def supplier_property_join(query)
|
||||
query.joins("
|
||||
def supplier_property_join
|
||||
@query = @query.joins("
|
||||
JOIN enterprises ON enterprises.id = first_variant.supplier_id
|
||||
LEFT OUTER JOIN producer_properties ON producer_properties.producer_id = enterprises.id
|
||||
")
|
||||
|
||||
Reference in New Issue
Block a user