summaryrefslogtreecommitdiffstats
path: root/app/models/issue_query.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-08-09 09:50:20 +0000
committerGo MAEDA <maeda@farend.jp>2019-08-09 09:50:20 +0000
commitdedcde4f070d366d3b75c945a7e6be9c3c12699f (patch)
tree8341dfb724436bbc6759dfe6eb821b591414943d /app/models/issue_query.rb
parent7b2482f5ba23a5555ed0d7ba3a9f202036fb8f75 (diff)
downloadredmine-dedcde4f070d366d3b75c945a7e6be9c3c12699f.tar.gz
redmine-dedcde4f070d366d3b75c945a7e6be9c3c12699f.zip
Merged r18356 from trunk to 3.4-stable (#31778).
git-svn-id: http://svn.redmine.org/redmine/branches/3.4-stable@18360 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/issue_query.rb')
-rw-r--r--app/models/issue_query.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb
index c6e457877..668941bdd 100644
--- a/app/models/issue_query.rb
+++ b/app/models/issue_query.rb
@@ -37,8 +37,8 @@ class IssueQuery < Query
QueryColumn.new(:due_date, :sortable => "#{Issue.table_name}.due_date"),
QueryColumn.new(:estimated_hours, :sortable => "#{Issue.table_name}.estimated_hours", :totalable => true),
QueryColumn.new(:total_estimated_hours,
- :sortable => "COALESCE((SELECT SUM(estimated_hours) FROM #{Issue.table_name} subtasks" +
- " WHERE subtasks.root_id = #{Issue.table_name}.root_id AND subtasks.lft >= #{Issue.table_name}.lft AND subtasks.rgt <= #{Issue.table_name}.rgt), 0)",
+ :sortable => -> { "COALESCE((SELECT SUM(estimated_hours) FROM #{Issue.table_name} subtasks" +
+ " WHERE #{Issue.visible_condition(User.current).gsub(/\bissues\b/, 'subtasks')} AND 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'),
QueryColumn.new(:done_ratio, :sortable => "#{Issue.table_name}.done_ratio", :groupable => true),
QueryColumn.new(:created_on, :sortable => "#{Issue.table_name}.created_on", :default_order => 'desc'),