From 9d9d6851b9164cd01bac8131f682688aa4038c9f Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Sat, 4 Jul 2020 12:14:27 +0000 Subject: [PATCH] avoid multi-line ternary operators in app/models/issue_query.rb git-svn-id: http://svn.redmine.org/redmine/trunk@19856 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/issue_query.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb index f33837337..79905b11a 100644 --- a/app/models/issue_query.rb +++ b/app/models/issue_query.rb @@ -499,10 +499,12 @@ class IssueQuery < Query "(#{nl} #{Issue.table_name}.assigned_to_id #{sw} IN (SELECT DISTINCT #{Member.table_name}.user_id FROM #{Member.table_name}" + " WHERE #{Member.table_name}.project_id = #{Issue.table_name}.project_id))" when "=", "!" - role_cond = value.any? ? - "#{MemberRole.table_name}.role_id IN (" + value.collect{|val| "'#{self.class.connection.quote_string(val)}'"}.join(",") + ")" : - "1=0" - + role_cond = + if value.any? + "#{MemberRole.table_name}.role_id IN (" + value.collect{|val| "'#{self.class.connection.quote_string(val)}'"}.join(",") + ")" + else + "1=0" + end sw = operator == "!" ? 'NOT' : '' nl = operator == "!" ? "#{Issue.table_name}.assigned_to_id IS NULL OR" : '' "(#{nl} #{Issue.table_name}.assigned_to_id #{sw} IN (SELECT DISTINCT #{Member.table_name}.user_id FROM #{Member.table_name}, #{MemberRole.table_name}" + -- 2.39.5