mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-21 05:09:15 +00:00
Make /api/orders N+1 free
With the help of the bullet gem, and since we remove a couple of N+1s already, remove them all was just a few keystrokes away. This commits gets us from 42 SQL queries to 17, and 364.5ms to 253.9ms on my machine where I just have the sample data's orders. As usual, this will have a much bigger impact in scenarios with more data.
This commit is contained in:
@@ -14,7 +14,7 @@ class SearchOrders
|
||||
|
||||
def fetch_orders
|
||||
@search = search_query.
|
||||
includes(:payments, :subscription).
|
||||
includes(:payments, :subscription, :shipments, :bill_address, :distributor, :order_cycle).
|
||||
ransack(params[:q])
|
||||
|
||||
return paginated_results if using_pagination?
|
||||
|
||||
Reference in New Issue
Block a user