summaryrefslogtreecommitdiffstats
path: root/app/helpers/queries_helper.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2021-08-04 12:48:54 +0000
committerGo MAEDA <maeda@farend.jp>2021-08-04 12:48:54 +0000
commit75aaedfff330590d1be1957174b81b0452e83ab1 (patch)
tree23b8daaf89be98fd3c536bc9e7e58fcde1c54e50 /app/helpers/queries_helper.rb
parent633a6fae2a3e3f4f3d3680b93981db61bf040089 (diff)
downloadredmine-75aaedfff330590d1be1957174b81b0452e83ab1.tar.gz
redmine-75aaedfff330590d1be1957174b81b0452e83ab1.zip
Avoid executing the same SQL statement multiple times to get the default custom query (#7360).
git-svn-id: http://svn.redmine.org/redmine/trunk@21134 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers/queries_helper.rb')
-rw-r--r--app/helpers/queries_helper.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb
index a76ae9573..9b223f84a 100644
--- a/app/helpers/queries_helper.rb
+++ b/app/helpers/queries_helper.rb
@@ -465,6 +465,7 @@ module QueriesHelper
else
{}
end
+ default_query_by_class = {}
content_tag('h3', title) + "\n" +
content_tag(
'ul',
@@ -473,7 +474,9 @@ module QueriesHelper
clear_link = +''
clear_link_param = {:set_filter => 1, :sort => '', :project_id => @project}
- if query == query.class.default(project: @project)
+ default_query =
+ default_query_by_class[query.class] ||= query.class.default(project: @project)
+ if query == default_query
css << ' default'
clear_link_param[:without_default] = 1
end