1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-20 07:21:12 +00:00

Moves sort joins for issues to IssueQuery.

git-svn-id: http://svn.redmine.org/redmine/trunk@16216 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2017-01-17 19:41:35 +00:00
parent dfe2a91684
commit 82afdc7f78
2 changed files with 12 additions and 3 deletions

View File

@ -505,4 +505,16 @@ class IssueQuery < Query
IssueRelation::TYPES.keys.each do |relation_type|
alias_method "sql_for_#{relation_type}_field".to_sym, :sql_for_relations
end
def joins_for_order_statement(order_options)
joins = [super]
if order_options
if order_options.include?('authors')
joins << "LEFT OUTER JOIN #{User.table_name} authors ON authors.id = #{queried_table_name}.author_id"
end
end
joins.any? ? joins.join(' ') : nil
end
end

View File

@ -1297,9 +1297,6 @@ class Query < ActiveRecord::Base
joins = []
if order_options
if order_options.include?('authors')
joins << "LEFT OUTER JOIN #{User.table_name} authors ON authors.id = #{queried_table_name}.author_id"
end
order_options.scan(/cf_\d+/).uniq.each do |name|
column = available_columns.detect {|c| c.name.to_s == name}
join = column && column.custom_field.join_for_order_statement