Only return order with the selected shipping rates is true

Same concept as

https://github.com/openfoodfoundation/openfoodnetwork/blob/master/app/services/search_orders.rb#L31
This commit is contained in:
Jean-Baptiste Bellet
2021-07-28 17:05:50 +02:00
parent b113162582
commit 09491cfc6d

View File

@@ -126,7 +126,7 @@ module OpenFoodNetwork
def filter_to_shipping_method(orders)
if params[:shipping_method_in].present?
orders.joins(shipments: :shipping_rates).where(spree_shipping_rates: { shipping_method_id: params[:shipping_method_in] })
orders.joins(shipments: :shipping_rates).where(spree_shipping_rates: { selected: true, shipping_method_id: params[:shipping_method_in] })
else
orders
end