Project

General

Profile

Feature #11253 » spent_time_on_parents_hack_redmine251.patch

#11253_vs_redmine251 - Scott Cunningham, 2014-04-24 20:58

View differences:

issue_query.rb Thu Apr 24 12:38:43 2014 -0500 → issue_query.rb Thu Apr 24 13:44:28 2014 -0500
258 258
      @available_columns.each_with_index {|column, i| index = i if column.name == :estimated_hours}
259 259
      index = (index ? index + 1 : -1)
260 260
      # insert the column after estimated_hours or at the end
261
      @available_columns.insert index, QueryColumn.new(:spent_hours,
262
        :sortable => "COALESCE((SELECT SUM(hours) FROM #{TimeEntry.table_name} WHERE #{TimeEntry.table_name}.issue_id = #{Issue.table_name}.id), 0)",
261
      @available_columns.insert index, QueryColumn.new(:total_spent_hours,
262
        :sortable => "COALESCE((SELECT SUM(hours) FROM #{TimeEntry.table_name} time_entry LEFT JOIN #{Issue.table_name} child_issue ON time_entry.issue_id = child_issue.id WHERE #{TimeEntry.table_name}.issue_id = #{Issue.table_name}.id OR child_issue.parent_id IS NOT NULL), 0)",
263 263
        :default_order => 'desc',
264 264
        :caption => :label_spent_time
265 265
      )
(5-5/9)