mirror of
https://github.com/meineerde/redmine.git
synced 2026-03-10 19:23:06 +00:00
Merged r16999 and r17000 (#26667).
git-svn-id: http://svn.redmine.org/redmine/branches/3.4-stable@17001 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
f793340077
commit
80cf4fd5db
@ -63,7 +63,7 @@ class TimeEntryQuery < Query
|
||||
add_available_filter("issue.fixed_version_id",
|
||||
:type => :list,
|
||||
:name => l("label_attribute_of_issue", :name => l(:field_fixed_version)),
|
||||
:values => lambda { fixed_version_values }) if project
|
||||
:values => lambda { fixed_version_values })
|
||||
|
||||
add_available_filter("user_id",
|
||||
:type => :list_optional, :values => lambda { author_values }
|
||||
@ -159,7 +159,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?
|
||||
|
||||
@ -556,6 +556,20 @@ class QueriesControllerTest < Redmine::ControllerTest
|
||||
assert_include ["eCookbook - 2.0", "3", "open"], json
|
||||
end
|
||||
|
||||
def test_version_filter_time_entries_with_project_id_should_return_filter_values
|
||||
@request.session[:user_id] = 2
|
||||
get :filter, :params => {
|
||||
:project_id => 1,
|
||||
:type => 'TimeEntryQuery',
|
||||
:name => 'issue.fixed_version_id'
|
||||
}
|
||||
|
||||
assert_response :success
|
||||
assert_equal 'application/json', response.content_type
|
||||
json = ActiveSupport::JSON.decode(response.body)
|
||||
assert_include ["eCookbook - 2.0", "3", "open"], json
|
||||
end
|
||||
|
||||
def test_filter_without_project_id_should_return_filter_values
|
||||
@request.session[:user_id] = 2
|
||||
get :filter, :params => {
|
||||
|
||||
@ -791,6 +791,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',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user