Use joins instead of sub-queries in group by/sort by when using custom fields (#12713).

Sub-queries in group by are not supported by SQLServer.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11102 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2013-01-03 12:28:50 +00:00
parent 049eaeb776
commit d82159bcf5
3 changed files with 26 additions and 22 deletions
+1 -1
View File
@@ -253,7 +253,7 @@ class IssueQuery < Query
if grouped?
begin
# Rails3 will raise an (unexpected) RecordNotFound if there's only a nil group value
r = Issue.visible.count(:group => group_by_statement, :include => [:status, :project], :conditions => statement)
r = Issue.visible.count(:joins => joins_for_order_statement(group_by_statement), :group => group_by_statement, :include => [:status, :project], :conditions => statement)
rescue ActiveRecord::RecordNotFound
r = {nil => issue_count}
end