Просмотр исходного кода

Fix filter after multiple version ids (#26667).

Patch by Marius BALTEANU.

git-svn-id: http://svn.redmine.org/redmine/trunk@17000 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/4.0.0
Jean-Philippe Lang 6 лет назад
Родитель
Сommit
5a775287ab
2 измененных файлов: 22 добавлений и 1 удалений
  1. 1
    1
      app/models/time_entry_query.rb
  2. 21
    0
      test/functional/timelog_controller_test.rb

+ 1
- 1
app/models/time_entry_query.rb Просмотреть файл

@@ -160,7 +160,7 @@ class TimeEntryQuery < Query
end

def sql_for_issue_fixed_version_id_field(field, operator, value)
issue_ids = Issue.where(:fixed_version_id => value.first.to_i).pluck(:id)
issue_ids = Issue.where(:fixed_version_id => value.map(&:to_i)).pluck(:id)
case operator
when "="
if issue_ids.any?

+ 21
- 0
test/functional/timelog_controller_test.rb Просмотреть файл

@@ -826,6 +826,27 @@ class TimelogControllerTest < Redmine::ControllerTest
assert_select '.total-for-hours', :text => 'Hours: 5.00'
end

def test_index_at_project_level_with_multiple_issue_fixed_version_ids
version = Version.generate!(:project_id => 1)
version2 = Version.generate!(:project_id => 1)
issue = Issue.generate!(:project_id => 1, :fixed_version => version)
issue2 = Issue.generate!(:project_id => 1, :fixed_version => version2)
TimeEntry.generate!(:issue => issue, :hours => 2)
TimeEntry.generate!(:issue => issue2, :hours => 3)
@request.session[:user_id] = 2

get :index, :params => {
:project_id => 'ecookbook',
:f => ['issue.fixed_version_id'],
:op => {'issue.fixed_version_id' => '='},
:v => {'issue.fixed_version_id' => [version.id.to_s,version2.id.to_s]}
}
assert_response :success

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

def test_index_at_project_level_with_date_range
get :index, :params => {
:project_id => 'ecookbook',

Загрузка…
Отмена
Сохранить