Project

General

Profile

Defect #38055 » 2022-12-17-issue-filter.patch

Ko Nagase, 2022-12-17 08:53

View differences:

app/models/query.rb
sql = sql_contains("#{db_table}.#{db_field}", value.first)
when "!~"
sql = sql_contains("#{db_table}.#{db_field}", value.first, :match => false)
sql += " OR #{db_table}.#{db_field} IS NULL" if is_custom_filter
when "^"
sql = sql_contains("#{db_table}.#{db_field}", value.first, :starts_with => true)
when "$"
test/unit/query_test.rb
assert_not_include issue, result
end
def test_operator_does_not_contain_on_text_custom_field
query = IssueQuery.new(:name => '_')
query.filters = {"cf_2" => {:operator => '!~', :values => ['125']}}
result = find_issues_with_query(query)
# "cf_2" (Searchable field) custom field's available trackers are only 1:Bug and 3:Support request.
# 8(Issue.visible.where(tracker: [1,3])) - 2(contain "125") = 6(not contain "125")
assert_equal 6, result.size
end
def test_range_for_this_week_with_week_starting_on_monday
I18n.locale = :fr
assert_equal '1', I18n.t(:general_first_day_of_week)
(1-1/2)