]> source.dussan.org Git - redmine.git/commitdiff
Filtering time entries after issue's target version doesn't work as expected in some...
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 15 Oct 2017 11:42:00 +0000 (11:42 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 15 Oct 2017 11:42:00 +0000 (11:42 +0000)
Patch by Marius BALTEANU.

git-svn-id: http://svn.redmine.org/redmine/trunk@16997 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/time_entry_query.rb
test/functional/queries_controller_test.rb

index fcd433b082b19c48a6f6870cb8aa823b6663dd55..f146a34dabc0f1361944fce7bb9ed7245ea26d9c 100644 (file)
@@ -36,8 +36,7 @@ class TimeEntryQuery < Query
 
   def initialize(attributes=nil, *args)
     super attributes
-    self.filters ||= {}
-    add_filter('spent_on', '*') unless filters.present?
+    self.filters ||= { 'spent_on' => {:operator => "*", :values => []} }
   end
 
   def initialize_available_filters
index 35b5832b47835c1373960d250e9dbaebb5a8da04..c61d5f0ea580ba4f9a787c1ef8a3ab9c61224a4b 100644 (file)
@@ -592,4 +592,19 @@ class QueriesControllerTest < Redmine::ControllerTest
     json = ActiveSupport::JSON.decode(response.body)
     assert_include ["OnlineStore - Systemwide visible version", "7", "open"], json
   end
+
+  def test_subproject_filter_time_entries_with_project_id_should_return_filter_values
+    @request.session[:user_id] = 2
+    get :filter, :params => {
+        :project_id => 1,
+        :type => 'TimeEntryQuery',
+        :name => 'subproject_id'
+      }
+
+    assert_response :success
+    assert_equal 'application/json', response.content_type
+    json = ActiveSupport::JSON.decode(response.body)
+    assert_equal 4, json.count
+    assert_include ["Private child of eCookbook","5"], json
+  end
 end