From 75aaedfff330590d1be1957174b81b0452e83ab1 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Wed, 4 Aug 2021 12:48:54 +0000 Subject: [PATCH] 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 --- app/helpers/queries_helper.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- 2.39.5