@@ -449,6 +449,17 class IssueQuery < Query | |||||
449 | end |
|
449 | end | |
450 | end |
|
450 | end | |
451 |
|
451 | |||
|
452 | def sql_for_updated_on_field(field, operator, value) | |||
|
453 | case operator | |||
|
454 | when "!*" | |||
|
455 | "#{Issue.table_name}.updated_on = #{Issue.table_name}.created_on" | |||
|
456 | when "*" | |||
|
457 | "#{Issue.table_name}.updated_on > #{Issue.table_name}.created_on" | |||
|
458 | else | |||
|
459 | sql_for_field("updated_on", operator, value, Issue.table_name, "updated_on") | |||
|
460 | end | |||
|
461 | end | |||
|
462 | ||||
452 | def sql_for_issue_id_field(field, operator, value) |
|
463 | def sql_for_issue_id_field(field, operator, value) | |
453 | if operator == "=" |
|
464 | if operator == "=" | |
454 | # accepts a comma separated list of ids |
|
465 | # accepts a comma separated list of ids |
@@ -1900,4 +1900,19 class QueryTest < ActiveSupport::TestCase | |||||
1900 | assert_equal [1, 2, 3, 6, 7, 8, 9, 10, 11, 12], issues.map(&:id).sort |
|
1900 | assert_equal [1, 2, 3, 6, 7, 8, 9, 10, 11, 12], issues.map(&:id).sort | |
1901 | end |
|
1901 | end | |
1902 |
|
1902 | |||
|
1903 | def test_filter_updated_on_none_should_return_issues_with_updated_on_equal_with_created_on | |||
|
1904 | query = IssueQuery.new(:name => '_', :project => Project.find(1)) | |||
|
1905 | ||||
|
1906 | query.filters = {'updated_on' => {:operator => '!*', :values => ['']}} | |||
|
1907 | issues = find_issues_with_query(query) | |||
|
1908 | assert_equal [3, 6, 7, 8, 9, 10, 14], issues.map(&:id).sort | |||
|
1909 | end | |||
|
1910 | ||||
|
1911 | def test_filter_updated_on_any_should_return_issues_with_updated_on_greater_than_created_on | |||
|
1912 | query = IssueQuery.new(:name => '_', :project => Project.find(1)) | |||
|
1913 | ||||
|
1914 | query.filters = {'updated_on' => {:operator => '*', :values => ['']}} | |||
|
1915 | issues = find_issues_with_query(query) | |||
|
1916 | assert_equal [1, 2, 5, 11, 12, 13], issues.map(&:id).sort | |||
|
1917 | end | |||
1903 | end |
|
1918 | end |
General Comments 0
You need to be logged in to leave comments.
Login now