Project

General

Profile

Defect #38055 ยป 2022-12-17-issue-filter.patch

Ko Nagase, 2022-12-17 08:53

View differences:

app/models/query.rb
1427 1427
      sql = sql_contains("#{db_table}.#{db_field}", value.first)
1428 1428
    when "!~"
1429 1429
      sql = sql_contains("#{db_table}.#{db_field}", value.first, :match => false)
1430
      sql += " OR #{db_table}.#{db_field} IS NULL" if is_custom_filter
1430 1431
    when "^"
1431 1432
      sql = sql_contains("#{db_table}.#{db_field}", value.first, :starts_with => true)
1432 1433
    when "$"
test/unit/query_test.rb
710 710
    assert_not_include issue, result
711 711
  end
712 712

  
713
  def test_operator_does_not_contain_on_text_custom_field
714
    query = IssueQuery.new(:name => '_')
715
    query.filters = {"cf_2" => {:operator => '!~', :values => ['125']}}
716
    result = find_issues_with_query(query)
717
    # "cf_2" (Searchable field) custom field's available trackers are only 1:Bug and 3:Support request.
718
    # 8(Issue.visible.where(tracker: [1,3])) - 2(contain "125") = 6(not contain "125")
719
    assert_equal 6, result.size
720
  end
721

  
713 722
  def test_range_for_this_week_with_week_starting_on_monday
714 723
    I18n.locale = :fr
715 724
    assert_equal '1', I18n.t(:general_first_day_of_week)
    (1-1/1)