Fixes spent time column sort for postgresql.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8077 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2011-12-04 19:13:09 +00:00
parent cad148cb5c
commit 68149f8c73
1 changed files with 1 additions and 1 deletions

View File

@ -367,7 +367,7 @@ class Query < ActiveRecord::Base
index = (index ? index + 1 : -1)
# insert the column after estimated_hours or at the end
@available_columns.insert index, QueryColumn.new(:spent_hours,
:sortable => "(SELECT SUM(hours) FROM #{TimeEntry.table_name} WHERE #{TimeEntry.table_name}.issue_id = #{Issue.table_name}.id)",
:sortable => "(SELECT COALESCE(SUM(hours), 0) FROM #{TimeEntry.table_name} WHERE #{TimeEntry.table_name}.issue_id = #{Issue.table_name}.id)",
:default_order => 'desc',
:caption => :label_spent_time
)