Project

General

Profile

Feature #30346 » 0001-Adds-Target-Version-column-to-the-list-of-Available-.patch

Marius BĂLTEANU, 2019-11-06 22:36

View differences:

app/models/time_entry_query.rb
34 34
    QueryAssociationColumn.new(:issue, :tracker, :caption => :field_tracker, :sortable => "#{Tracker.table_name}.position"),
35 35
    QueryAssociationColumn.new(:issue, :status, :caption => :field_status, :sortable => "#{IssueStatus.table_name}.position"),
36 36
    QueryAssociationColumn.new(:issue, :category, :caption => :field_category, :sortable => "#{IssueCategory.table_name}.name"),
37
    QueryAssociationColumn.new(:issue, :fixed_version_id, :caption => :field_fixed_version, :sortable => Version.fields_for_order_statement),
37 38
    QueryColumn.new(:comments),
38 39
    QueryColumn.new(:hours, :sortable => "#{TimeEntry.table_name}.hours", :totalable => true),
39 40
  ]
......
247 248
      if order_options.include?('issue_categories')
248 249
        joins << "LEFT OUTER JOIN #{IssueCategory.table_name} ON #{IssueCategory.table_name}.id = #{Issue.table_name}.category_id"
249 250
      end
251
      if order_options.include?('versions')
252
        joins << "LEFT OUTER JOIN #{Version.table_name} ON #{Version.table_name}.id = #{Issue.table_name}.fixed_version_id"
253
      end
250 254
    end
251 255

  
252 256
    joins.compact!
test/functional/timelog_controller_test.rb
1193 1193
    assert_select 'td.issue-category', :text => 'Printing'
1194 1194
  end
1195 1195

  
1196
  def test_index_with_issue_fixed_version_column
1197
    issue = Issue.find(1)
1198
    issue.fixed_version = Version.find(3)
1199
    issue.save!
1200

  
1201
    get :index, :params => {
1202
      :project_id => 'ecookbook',
1203
      :c => %w(project spent_on issue comments hours issue.fixed_version)
1204
    }
1205

  
1206
    assert_response :success
1207
    assert_select 'td.issue-fixed_version', :text => '2.0'
1208
  end
1209

  
1196 1210
  def test_index_with_author_filter
1197 1211
    get :index, :params => {
1198 1212
      :project_id => 'ecookbook',
......
1230 1244
    assert_equal ['Printing', 'Printing', 'Recipes'], values
1231 1245
  end
1232 1246

  
1247
  def test_index_with_issue_fixed_version_sort
1248
    issue = Issue.find(1)
1249
    issue.fixed_version = Version.find(3)
1250
    issue.save!
1251

  
1252
    TimeEntry.generate!(:issue => Issue.find(12))
1253

  
1254
    get :index, :params => {
1255
      :project_id => 'ecookbook',
1256
      :c => ["hours", 'issue.fixed_version'],
1257
      :sort => 'issue.fixed_version'
1258
    }
1259

  
1260
    assert_response :success
1261
    # Make sure that values are properly sorted
1262
    values = css_select("td.issue-fixed_version").map(&:text).reject(&:blank?)
1263
    assert_equal ['1.0', '2.0', '2.0'], values
1264
  end
1265

  
1233 1266
  def test_index_with_filter_on_issue_custom_field
1234 1267
    issue = Issue.generate!(:project_id => 1, :tracker_id => 1, :custom_field_values => {2 => 'filter_on_issue_custom_field'})
1235 1268
    entry = TimeEntry.generate!(:issue => issue, :hours => 2.5)
(3-3/3)