summaryrefslogtreecommitdiffstats
path: root/app/models/issue_query.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-07-05 12:16:56 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-07-05 12:16:56 +0000
commitf6ea714f52ae94d798ae1f4d47605942e00f790b (patch)
treeed6c484f6a6a996969050a6bca56f74d5d570512 /app/models/issue_query.rb
parent71942ec5a2b5bccc44c95d22a467e8c5a6be3d98 (diff)
downloadredmine-f6ea714f52ae94d798ae1f4d47605942e00f790b.tar.gz
redmine-f6ea714f52ae94d798ae1f4d47605942e00f790b.zip
Adds "Total spent hours" column available on the issue list (#11253).
git-svn-id: http://svn.redmine.org/redmine/trunk@14406 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/issue_query.rb')
-rw-r--r--app/models/issue_query.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb
index 20ea59630..edc1290fe 100644
--- a/app/models/issue_query.rb
+++ b/app/models/issue_query.rb
@@ -267,6 +267,12 @@ class IssueQuery < Query
:default_order => 'desc',
:caption => :label_spent_time
)
+ @available_columns.insert index+1, QueryColumn.new(:total_spent_hours,
+ :sortable => "COALESCE((SELECT SUM(hours) FROM #{TimeEntry.table_name} JOIN #{Issue.table_name} subtasks ON subtasks.id = #{TimeEntry.table_name}.issue_id" +
+ " WHERE subtasks.root_id = #{Issue.table_name}.root_id AND subtasks.lft >= #{Issue.table_name}.lft AND subtasks.rgt <= #{Issue.table_name}.rgt), 0)",
+ :default_order => 'desc',
+ :caption => :label_total_spent_time
+ )
end
if User.current.allowed_to?(:set_issues_private, nil, :global => true) ||