fix_available_columns_order_20150914.diff

patch (revised 2015-09-14) - Go MAEDA, 2015-09-14 03:24

Download (1022 Bytes)

View differences:

app/models/issue_query.rb (working copy)
262 262
                           ).visible.collect {|cf| QueryCustomFieldColumn.new(cf) }
263 263

  
264 264
    if User.current.allowed_to?(:view_time_entries, project, :global => true)
265
      index = nil
266
      @available_columns.each_with_index {|column, i| index = i if column.name == :estimated_hours}
265
      index = @available_columns.find_index {|column| column.name == :total_estimated_hours}
267 266
      index = (index ? index + 1 : -1)
268
      # insert the column after estimated_hours or at the end
267
      # insert the column after total_estimated_hours or at the end
269 268
      @available_columns.insert index, QueryColumn.new(:spent_hours,
270 269
        :sortable => "COALESCE((SELECT SUM(hours) FROM #{TimeEntry.table_name} WHERE #{TimeEntry.table_name}.issue_id = #{Issue.table_name}.id), 0)",
271 270
        :default_order => 'desc',