1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-19 15:01:14 +00:00

code cleanup: rubocop: fix Layout/CaseIndentation in app/models/issue_query.rb

git-svn-id: http://svn.redmine.org/redmine/trunk@18728 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2019-10-17 16:46:05 +00:00
parent 2140c49042
commit a8b7aa8299
2 changed files with 2 additions and 4 deletions

View File

@ -67,7 +67,6 @@ Layout/BlockEndNewline:
# SupportedStyles: case, end # SupportedStyles: case, end
Layout/CaseIndentation: Layout/CaseIndentation:
Exclude: Exclude:
- 'app/models/issue_query.rb'
- 'config/initializers/10-patches.rb' - 'config/initializers/10-patches.rb'
# Cop supports --auto-correct. # Cop supports --auto-correct.

View File

@ -614,8 +614,8 @@ class IssueQuery < Query
relation_type = relation_options[:reverse] || relation_type relation_type = relation_options[:reverse] || relation_type
join_column, target_join_column = target_join_column, join_column join_column, target_join_column = target_join_column, join_column
end end
sql =
sql = case operator case operator
when "*", "!*" when "*", "!*"
op = (operator == "*" ? 'IN' : 'NOT IN') op = (operator == "*" ? 'IN' : 'NOT IN')
"#{Issue.table_name}.id #{op} (SELECT DISTINCT #{IssueRelation.table_name}.#{join_column} FROM #{IssueRelation.table_name} WHERE #{IssueRelation.table_name}.relation_type = '#{self.class.connection.quote_string(relation_type)}')" "#{Issue.table_name}.id #{op} (SELECT DISTINCT #{IssueRelation.table_name}.#{join_column} FROM #{IssueRelation.table_name} WHERE #{IssueRelation.table_name}.relation_type = '#{self.class.connection.quote_string(relation_type)}')"
@ -630,7 +630,6 @@ class IssueQuery < Query
op = (operator == "!o" ? 'NOT IN' : 'IN') op = (operator == "!o" ? 'NOT IN' : 'IN')
"#{Issue.table_name}.id #{op} (SELECT DISTINCT #{IssueRelation.table_name}.#{join_column} FROM #{IssueRelation.table_name}, #{Issue.table_name} relissues WHERE #{IssueRelation.table_name}.relation_type = '#{self.class.connection.quote_string(relation_type)}' AND #{IssueRelation.table_name}.#{target_join_column} = relissues.id AND relissues.status_id IN (SELECT id FROM #{IssueStatus.table_name} WHERE is_closed=#{self.class.connection.quoted_false}))" "#{Issue.table_name}.id #{op} (SELECT DISTINCT #{IssueRelation.table_name}.#{join_column} FROM #{IssueRelation.table_name}, #{Issue.table_name} relissues WHERE #{IssueRelation.table_name}.relation_type = '#{self.class.connection.quote_string(relation_type)}' AND #{IssueRelation.table_name}.#{target_join_column} = relissues.id AND relissues.status_id IN (SELECT id FROM #{IssueStatus.table_name} WHERE is_closed=#{self.class.connection.quoted_false}))"
end end
if relation_options[:sym] == field && !options[:reverse] if relation_options[:sym] == field && !options[:reverse]
sqls = [sql, sql_for_relations(field, operator, value, :reverse => true)] sqls = [sql, sql_for_relations(field, operator, value, :reverse => true)]
sql = sqls.join(["!", "!*", "!p", '!o'].include?(operator) ? " AND " : " OR ") sql = sqls.join(["!", "!*", "!p", '!o'].include?(operator) ? " AND " : " OR ")