Parcourir la source

Adds a way to filter issues with or without start date (#9607).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7841 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/1.3.0
Jean-Philippe Lang il y a 12 ans
Parent
révision
12d05431c2
2 fichiers modifiés avec 18 ajouts et 2 suppressions
  1. 2
    2
      app/models/query.rb
  2. 16
    0
      test/unit/query_test.rb

+ 2
- 2
app/models/query.rb Voir le fichier

@@ -120,8 +120,8 @@ class Query < ActiveRecord::Base
:list_status => [ "o", "=", "!", "c", "*" ],
:list_optional => [ "=", "!", "!*", "*" ],
:list_subprojects => [ "*", "!*", "=" ],
:date => [ "=", ">=", "<=", "><", "<t+", ">t+", "t+", "t", "w", ">t-", "<t-", "t-" ],
:date_past => [ "=", ">=", "<=", "><", ">t-", "<t-", "t-", "t", "w" ],
:date => [ "=", ">=", "<=", "><", "<t+", ">t+", "t+", "t", "w", ">t-", "<t-", "t-", "!*", "*" ],
:date_past => [ "=", ">=", "<=", "><", ">t-", "<t-", "t-", "t", "w", "!*", "*" ],
:string => [ "=", "~", "!", "!~" ],
:text => [ "~", "!~" ],
:integer => [ "=", ">=", "<=", "><", "!*", "*" ],

+ 16
- 0
test/unit/query_test.rb Voir le fichier

@@ -97,6 +97,14 @@ class QueryTest < ActiveSupport::TestCase
assert issues.all? {|i| !i.estimated_hours}
end

def test_operator_none_for_date
query = Query.new(:project => Project.find(1), :name => '_')
query.add_filter('start_date', '!*', [''])
issues = find_issues_with_query(query)
assert !issues.empty?
assert issues.all? {|i| i.start_date.nil?}
end

def test_operator_all
query = Query.new(:project => Project.find(1), :name => '_')
query.add_filter('fixed_version_id', '*', [''])
@@ -106,6 +114,14 @@ class QueryTest < ActiveSupport::TestCase
find_issues_with_query(query)
end

def test_operator_all_for_date
query = Query.new(:project => Project.find(1), :name => '_')
query.add_filter('start_date', '*', [''])
issues = find_issues_with_query(query)
assert !issues.empty?
assert issues.all? {|i| i.start_date.present?}
end

def test_numeric_filter_should_not_accept_non_numeric_values
query = Query.new(:name => '_')
query.add_filter('estimated_hours', '=', ['a'])

Chargement…
Annuler
Enregistrer