mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Cache distributor
This commit is contained in:
@@ -42,7 +42,7 @@ module OpenFoodNetwork
|
||||
end
|
||||
|
||||
def distributor
|
||||
Enterprise.find params[:distributor_id]
|
||||
@distributor ||= Enterprise.find params[:distributor_id]
|
||||
end
|
||||
|
||||
def scope_to_schedule
|
||||
|
||||
@@ -66,7 +66,7 @@ RSpec.describe OpenFoodNetwork::ScopeVariantsForSearch do
|
||||
|
||||
it "returns all products distributed through that distributor" do
|
||||
expect{ result }.to query_database [
|
||||
"Enterprise Load", "Enterprise Load", "Enterprise Load", # loads same enterprise three times
|
||||
"Enterprise Load",
|
||||
"VariantOverride Load",
|
||||
"SQL"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user