0001-Group-time-entries-by-created-date.patch

Marius BALTEANU, 2018-12-16 16:36

Download (2.28 KB)

View differences:

app/models/time_entry_query.rb
23 23
  self.available_columns = [
24 24
    QueryColumn.new(:project, :sortable => "#{Project.table_name}.name", :groupable => true),
25 25
    QueryColumn.new(:spent_on, :sortable => ["#{TimeEntry.table_name}.spent_on", "#{TimeEntry.table_name}.created_on"], :default_order => 'desc', :groupable => true),
26
    QueryColumn.new(:created_on, :sortable => "#{TimeEntry.table_name}.created_on", :default_order => 'desc'),
26
    TimestampQueryColumn.new(:created_on, :sortable => "#{TimeEntry.table_name}.created_on", :default_order => 'desc', :groupable => true),
27 27
    QueryColumn.new(:tweek, :sortable => ["#{TimeEntry.table_name}.spent_on", "#{TimeEntry.table_name}.created_on"], :caption => :label_week),
28 28
    QueryColumn.new(:user, :sortable => lambda {User.fields_for_order_statement}, :groupable => true),
29 29
    QueryColumn.new(:activity, :sortable => "#{TimeEntryActivity.table_name}.position", :groupable => true),
test/functional/timelog_controller_test.rb
1257 1257
    assert_not_nil line
1258 1258
    assert_include "#{issue.tracker} #1: #{issue.subject}", line
1259 1259
  end
1260

  
1261
  def test_index_grouped_by_created_on
1262
    skip unless TimeEntryQuery.new.groupable_columns.detect {|c| c.name == :created_on}
1263

  
1264
    get :index, :params => {
1265
        :set_filter => 1,
1266
        :group_by => 'created_on'
1267
      }
1268
    assert_response :success
1269

  
1270
    assert_select 'tr.group span.name', :text => '03/23/2007' do
1271
      assert_select '+ span.count', :text => '2'
1272
    end
1273
  end
1260 1274
end
1261
-