mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
Optimise by pre-loading required columns
Oh boy, that's a big change.
This commit is contained in:
@@ -87,14 +87,16 @@ module Admin
|
||||
|
||||
# Optimise by pre-loading required columns
|
||||
def product_query_includes
|
||||
# TODO: add other fields used in columns? (eg supplier: [:name])
|
||||
[
|
||||
# variants: [
|
||||
# :default_price,
|
||||
# :stock_locations,
|
||||
# :stock_items,
|
||||
# :variant_overrides
|
||||
# ]
|
||||
:image,
|
||||
:supplier,
|
||||
{ variants: [
|
||||
:default_price,
|
||||
:primary_taxon,
|
||||
:product,
|
||||
:stock_items,
|
||||
:tax_category,
|
||||
] },
|
||||
]
|
||||
end
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ describe 'As an admin, I can manage products', feature: :admin_style_v3 do
|
||||
|
||||
expect{
|
||||
visit admin_products_url
|
||||
}.to query_database 416.times # goodness me. Remember this includes user session updates etc.
|
||||
}.to query_database 243.times # Remember this includes user session updates etc.
|
||||
end
|
||||
|
||||
describe "sorting" do
|
||||
|
||||
Reference in New Issue
Block a user