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 }
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?
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 => {
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',