Fix multiple results with 'inventory_items_shipment_id_null' ransack query

The q['inventory_items_shipment_id_null'] search element was generating duplicates where there were multiple line items on an order that were ready to be shipped, with id = null
This commit is contained in:
Matt-Yorkley
2018-12-10 20:08:06 +00:00
parent e711c5ed03
commit 0c5ac99e0f

View File

@@ -26,11 +26,11 @@ class SearchOrders
@search = OpenFoodNetwork::Permissions.new(current_user).editable_orders.ransack(params[:q])
return paginated_results if using_pagination?
@search.result
@search.result(distinct: true)
end
def paginated_results
@search.result
@search.result(distinct: true)
.page(params[:page])
.per(params[:per_page])
end