##// END OF EJS Templates
Adds a way to filter issues with or without start date (#9607)....
Jean-Philippe Lang -
r7721:12d05431c20e
parent child
Show More
@@ -120,8 +120,8 class Query < ActiveRecord::Base
120 :list_status => [ "o", "=", "!", "c", "*" ],
120 :list_status => [ "o", "=", "!", "c", "*" ],
121 :list_optional => [ "=", "!", "!*", "*" ],
121 :list_optional => [ "=", "!", "!*", "*" ],
122 :list_subprojects => [ "*", "!*", "=" ],
122 :list_subprojects => [ "*", "!*", "=" ],
123 :date => [ "=", ">=", "<=", "><", "<t+", ">t+", "t+", "t", "w", ">t-", "<t-", "t-" ],
123 :date => [ "=", ">=", "<=", "><", "<t+", ">t+", "t+", "t", "w", ">t-", "<t-", "t-", "!*", "*" ],
124 :date_past => [ "=", ">=", "<=", "><", ">t-", "<t-", "t-", "t", "w" ],
124 :date_past => [ "=", ">=", "<=", "><", ">t-", "<t-", "t-", "t", "w", "!*", "*" ],
125 :string => [ "=", "~", "!", "!~" ],
125 :string => [ "=", "~", "!", "!~" ],
126 :text => [ "~", "!~" ],
126 :text => [ "~", "!~" ],
127 :integer => [ "=", ">=", "<=", "><", "!*", "*" ],
127 :integer => [ "=", ">=", "<=", "><", "!*", "*" ],
@@ -97,6 +97,14 class QueryTest < ActiveSupport::TestCase
97 assert issues.all? {|i| !i.estimated_hours}
97 assert issues.all? {|i| !i.estimated_hours}
98 end
98 end
99
99
100 def test_operator_none_for_date
101 query = Query.new(:project => Project.find(1), :name => '_')
102 query.add_filter('start_date', '!*', [''])
103 issues = find_issues_with_query(query)
104 assert !issues.empty?
105 assert issues.all? {|i| i.start_date.nil?}
106 end
107
100 def test_operator_all
108 def test_operator_all
101 query = Query.new(:project => Project.find(1), :name => '_')
109 query = Query.new(:project => Project.find(1), :name => '_')
102 query.add_filter('fixed_version_id', '*', [''])
110 query.add_filter('fixed_version_id', '*', [''])
@@ -106,6 +114,14 class QueryTest < ActiveSupport::TestCase
106 find_issues_with_query(query)
114 find_issues_with_query(query)
107 end
115 end
108
116
117 def test_operator_all_for_date
118 query = Query.new(:project => Project.find(1), :name => '_')
119 query.add_filter('start_date', '*', [''])
120 issues = find_issues_with_query(query)
121 assert !issues.empty?
122 assert issues.all? {|i| i.start_date.present?}
123 end
124
109 def test_numeric_filter_should_not_accept_non_numeric_values
125 def test_numeric_filter_should_not_accept_non_numeric_values
110 query = Query.new(:name => '_')
126 query = Query.new(:name => '_')
111 query.add_filter('estimated_hours', '=', ['a'])
127 query.add_filter('estimated_hours', '=', ['a'])
General Comments 0
You need to be logged in to leave comments. Login now