]> source.dussan.org Git - redmine.git/commitdiff
Adds a way to filter issues with or without start date (#9607).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 19 Nov 2011 11:25:36 +0000 (11:25 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 19 Nov 2011 11:25:36 +0000 (11:25 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7841 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/query.rb
test/unit/query_test.rb

index 9eac4b81c7b2749a102c01954480d05e92d0509e..c25b75f2c1712bda9bf10b9621973af87c808cd1 100644 (file)
@@ -120,8 +120,8 @@ class Query < ActiveRecord::Base
                                  :list_status => [ "o", "=", "!", "c", "*" ],
                                  :list_optional => [ "=", "!", "!*", "*" ],
                                  :list_subprojects => [ "*", "!*", "=" ],
-                                 :date => [ "=", ">=", "<=", "><", "<t+", ">t+", "t+", "t", "w", ">t-", "<t-", "t-" ],
-                                 :date_past => [ "=", ">=", "<=", "><", ">t-", "<t-", "t-", "t", "w" ],
+                                 :date => [ "=", ">=", "<=", "><", "<t+", ">t+", "t+", "t", "w", ">t-", "<t-", "t-", "!*", "*" ],
+                                 :date_past => [ "=", ">=", "<=", "><", ">t-", "<t-", "t-", "t", "w", "!*", "*" ],
                                  :string => [ "=", "~", "!", "!~" ],
                                  :text => [  "~", "!~" ],
                                  :integer => [ "=", ">=", "<=", "><", "!*", "*" ],
index e364fdde39453f220d349dde508d862afbaa5e83..11e6151b3fe2d6cb7b950a4aa06c77dd3e1c6ac8 100644 (file)
@@ -97,6 +97,14 @@ class QueryTest < ActiveSupport::TestCase
     assert issues.all? {|i| !i.estimated_hours}
   end
 
+  def test_operator_none_for_date
+    query = Query.new(:project => Project.find(1), :name => '_')
+    query.add_filter('start_date', '!*', [''])
+    issues = find_issues_with_query(query)
+    assert !issues.empty?
+    assert issues.all? {|i| i.start_date.nil?}
+  end
+
   def test_operator_all
     query = Query.new(:project => Project.find(1), :name => '_')
     query.add_filter('fixed_version_id', '*', [''])
@@ -106,6 +114,14 @@ class QueryTest < ActiveSupport::TestCase
     find_issues_with_query(query)
   end
 
+  def test_operator_all_for_date
+    query = Query.new(:project => Project.find(1), :name => '_')
+    query.add_filter('start_date', '*', [''])
+    issues = find_issues_with_query(query)
+    assert !issues.empty?
+    assert issues.all? {|i| i.start_date.present?}
+  end
+
   def test_numeric_filter_should_not_accept_non_numeric_values
     query = Query.new(:name => '_')
     query.add_filter('estimated_hours', '=', ['a'])