mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Removed N+1 queries while counting line_items
This commit is contained in:
@@ -22,7 +22,7 @@ module Api
|
||||
end
|
||||
|
||||
def item_count
|
||||
object.line_items.sum(:quantity)
|
||||
object.line_items.size
|
||||
end
|
||||
|
||||
def completed_at
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
- content_for :injection_data do
|
||||
= inject_json_array("orders", @orders.all, Api::OrderSerializer)
|
||||
= inject_json_array("orders", @orders.all.includes(:line_items), Api::OrderSerializer)
|
||||
= inject_json_array("shops", @shops.all, Api::ShopForOrdersSerializer)
|
||||
= inject_saved_credit_cards
|
||||
|
||||
|
||||
Reference in New Issue
Block a user