summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-10-15 11:54:39 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-10-15 11:54:39 +0000
commit5a775287ab30c7a7d851fe064fc1afd12dbdad2d (patch)
tree783459bf3e64f92b87c188674428b87c76ae381f
parentcb73fc58f274624b79bacc73f63fcfcfe606e86d (diff)
downloadredmine-5a775287ab30c7a7d851fe064fc1afd12dbdad2d.tar.gz
redmine-5a775287ab30c7a7d851fe064fc1afd12dbdad2d.zip
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
-rw-r--r--app/models/time_entry_query.rb2
-rw-r--r--test/functional/timelog_controller_test.rb21
2 files changed, 22 insertions, 1 deletions
diff --git a/app/models/time_entry_query.rb b/app/models/time_entry_query.rb
index 1635b1b15..706c6b234 100644
--- a/app/models/time_entry_query.rb
+++ b/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?
diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb
index 50766f0fd..de975bbc4 100644
--- a/test/functional/timelog_controller_test.rb
+++ b/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',