Project

General

Profile

Feature #11253 » Feature11253-0.patch

Ben Dalling, 2013-01-16 20:27

View differences:

app/helpers/queries_helper.rb (working copy)
90 90
    when 'Fixnum', 'Float'
91 91
      if column.name == :done_ratio
92 92
        progress_bar(value, :width => '80px')
93
      elsif  column.name == :spent_hours
93
      elsif  column.name == :spent_hours || column.name == :total_spent_hours
94 94
        sprintf "%.2f", value
95 95
      else
96 96
        h(value.to_s)
app/models/query.rb (working copy)
470 470
      @available_columns.each_with_index {|column, i| index = i if column.name == :estimated_hours}
471 471
      index = (index ? index + 1 : -1)
472 472
      # insert the column after estimated_hours or at the end
473
      @available_columns.insert index, QueryColumn.new(:spent_hours,
474
        :sortable => "(SELECT COALESCE(SUM(hours), 0) FROM #{TimeEntry.table_name} WHERE #{TimeEntry.table_name}.issue_id = #{Issue.table_name}.id)",
473
      @available_columns.insert index, QueryColumn.new(:total_spent_hours,
474
        :sortable => "(SELECT COALESCE(SUM(hours), 0) 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)",
475 475
        :default_order => 'desc',
476 476
        :caption => :label_spent_time
477 477
      )
(3-3/9)