From: Go MAEDA Date: Wed, 4 Aug 2021 12:48:54 +0000 (+0000) Subject: Avoid executing the same SQL statement multiple times to get the default custom query... X-Git-Tag: 5.0.0~301 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=75aaedfff330590d1be1957174b81b0452e83ab1;p=redmine.git 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 --- 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