Defect #39991 » 39991.patch
| app/models/query.rb | ||
|---|---|---|
| 1276 | 1276 |
sql += " OR #{db_table}.#{db_field} = ''" if is_custom_filter || [:text, :string].include?(type_for(field))
|
| 1277 | 1277 |
when "*" |
| 1278 | 1278 |
sql = "#{db_table}.#{db_field} IS NOT NULL"
|
| 1279 |
sql += " AND #{db_table}.#{db_field} <> ''" if is_custom_filter
|
|
| 1279 |
sql += " AND #{db_table}.#{db_field} <> ''" if is_custom_filter || [:text, :string].include?(type_for(field))
|
|
| 1280 | 1280 |
when ">=" |
| 1281 | 1281 |
if [:date, :date_past].include?(type_for(field)) |
| 1282 | 1282 |
sql = date_clause(db_table, db_field, parse_date(value.first), nil, is_custom_filter) |
| test/unit/query_test.rb | ||
|---|---|---|
| 214 | 214 |
assert issues.all? {|i| i.custom_field_value(2).blank?}
|
| 215 | 215 |
end |
| 216 | 216 | |
| 217 |
def test_operator_none_for_text |
|
| 217 |
def test_operator_none_for_blank_text
|
|
| 218 | 218 |
query = IssueQuery.new(:name => '_') |
| 219 | 219 |
query.add_filter('status_id', '*', [''])
|
| 220 | 220 |
query.add_filter('description', '!*', [''])
|
| ... | ... | |
| 226 | 226 |
assert_equal [11, 12], issues.map(&:id).sort |
| 227 | 227 |
end |
| 228 | 228 | |
| 229 |
def test_operator_any_for_blank_text |
|
| 230 |
Issue.where(id: [1, 2]).update_all(description: '') |
|
| 231 |
query = IssueQuery.new(:name => '_') |
|
| 232 |
query.add_filter('status_id', '*', [''])
|
|
| 233 |
query.add_filter('description', '*', [''])
|
|
| 234 |
assert query.has_filter?('description')
|
|
| 235 |
issues = find_issues_with_query(query) |
|
| 236 | ||
| 237 |
assert issues.any? |
|
| 238 |
assert issues.all? {|i| i.description.present?}
|
|
| 239 |
assert_empty issues.map(&:id) & [1, 2] |
|
| 240 |
end |
|
| 241 | ||
| 229 | 242 |
def test_operator_all |
| 230 | 243 |
query = IssueQuery.new(:project => Project.find(1), :name => '_') |
| 231 | 244 |
query.add_filter('fixed_version_id', '*', [''])
|
- « Previous
- 1
- 2
- Next »