fix_filter_after_multiple_version_ids.patch

Marius BALTEANU, 2017-08-11 16:30

Download (1.83 KB)

View differences:

app/models/time_entry_query.rb
161 161
  end
162 162

  
163 163
  def sql_for_issue_fixed_version_id_field(field, operator, value)
164
    issue_ids = Issue.where(:fixed_version_id => value.first.to_i).pluck(:id)
164
    issue_ids = Issue.where(:fixed_version_id => value.map(&:to_i)).pluck(:id)
165 165
    case operator
166 166
    when "="
167 167
      if issue_ids.any?
test/functional/timelog_controller_test.rb
826 826
    assert_select '.total-for-hours', :text => 'Hours: 5.00'
827 827
  end
828 828

  
829
  def test_index_at_project_level_with_multiple_issue_fixed_version_ids
830
    version = Version.generate!(:project_id => 1)
831
    version2 = Version.generate!(:project_id => 1)
832
    issue = Issue.generate!(:project_id => 1, :fixed_version => version)
833
    issue2 = Issue.generate!(:project_id => 1, :fixed_version => version2)
834
    TimeEntry.generate!(:issue => issue, :hours => 2)
835
    TimeEntry.generate!(:issue => issue2, :hours => 3)
836
    @request.session[:user_id] = 2
837

  
838
    get :index, :params => {
839
      :project_id => 'ecookbook',
840
      :f => ['issue.fixed_version_id'],
841
      :op => {'issue.fixed_version_id' => '='},
842
      :v => {'issue.fixed_version_id' => [version.id.to_s,version2.id.to_s]}
843
    }
844
    assert_response :success
845

  
846
    assert_select 'tr.time-entry', 2
847
    assert_select '.total-for-hours', :text => 'Hours: 5.00'
848
  end
849

  
829 850
  def test_index_at_project_level_with_date_range
830 851
    get :index, :params => {
831 852
      :project_id => 'ecookbook',