##// END OF EJS Templates
Adds all/none operators to text custom field filters (#9790)....
Jean-Philippe Lang -
r9488:a99c61b4714c
parent child
Show More
@@ -126,8 +126,8 class Query < ActiveRecord::Base
126 :list_subprojects => [ "*", "!*", "=" ],
126 :list_subprojects => [ "*", "!*", "=" ],
127 :date => [ "=", ">=", "<=", "><", "<t+", ">t+", "t+", "t", "w", ">t-", "<t-", "t-", "!*", "*" ],
127 :date => [ "=", ">=", "<=", "><", "<t+", ">t+", "t+", "t", "w", ">t-", "<t-", "t-", "!*", "*" ],
128 :date_past => [ "=", ">=", "<=", "><", ">t-", "<t-", "t-", "t", "w", "!*", "*" ],
128 :date_past => [ "=", ">=", "<=", "><", ">t-", "<t-", "t-", "t", "w", "!*", "*" ],
129 :string => [ "=", "~", "!", "!~" ],
129 :string => [ "=", "~", "!", "!~", "!*", "*" ],
130 :text => [ "~", "!~" ],
130 :text => [ "~", "!~", "!*", "*" ],
131 :integer => [ "=", ">=", "<=", "><", "!*", "*" ],
131 :integer => [ "=", ">=", "<=", "><", "!*", "*" ],
132 :float => [ "=", ">=", "<=", "><", "!*", "*" ] }
132 :float => [ "=", ">=", "<=", "><", "!*", "*" ] }
133
133
@@ -21,6 +21,7 custom_fields_002:
21 min_length: 1
21 min_length: 1
22 regexp: ""
22 regexp: ""
23 is_for_all: true
23 is_for_all: true
24 is_filter: true
24 type: IssueCustomField
25 type: IssueCustomField
25 max_length: 100
26 max_length: 100
26 possible_values: ""
27 possible_values: ""
@@ -112,6 +112,15 class QueryTest < ActiveSupport::TestCase
112 assert issues.all? {|i| i.start_date.nil?}
112 assert issues.all? {|i| i.start_date.nil?}
113 end
113 end
114
114
115 def test_operator_none_for_string_custom_field
116 query = Query.new(:project => Project.find(1), :name => '_')
117 query.add_filter('cf_2', '!*', [''])
118 assert query.has_filter?('cf_2')
119 issues = find_issues_with_query(query)
120 assert !issues.empty?
121 assert issues.all? {|i| i.custom_field_value(2).blank?}
122 end
123
115 def test_operator_all
124 def test_operator_all
116 query = Query.new(:project => Project.find(1), :name => '_')
125 query = Query.new(:project => Project.find(1), :name => '_')
117 query.add_filter('fixed_version_id', '*', [''])
126 query.add_filter('fixed_version_id', '*', [''])
@@ -129,6 +138,15 class QueryTest < ActiveSupport::TestCase
129 assert issues.all? {|i| i.start_date.present?}
138 assert issues.all? {|i| i.start_date.present?}
130 end
139 end
131
140
141 def test_operator_all_for_string_custom_field
142 query = Query.new(:project => Project.find(1), :name => '_')
143 query.add_filter('cf_2', '*', [''])
144 assert query.has_filter?('cf_2')
145 issues = find_issues_with_query(query)
146 assert !issues.empty?
147 assert issues.all? {|i| i.custom_field_value(2).present?}
148 end
149
132 def test_numeric_filter_should_not_accept_non_numeric_values
150 def test_numeric_filter_should_not_accept_non_numeric_values
133 query = Query.new(:name => '_')
151 query = Query.new(:name => '_')
134 query.add_filter('estimated_hours', '=', ['a'])
152 query.add_filter('estimated_hours', '=', ['a'])
General Comments 0
You need to be logged in to leave comments. Login now