Commit 0c0be3db authored by Reed Loden's avatar Reed Loden

Bug 545576 - "Add "greaterthaneq" and "lessthaneq" charts to do >= and <= searches"

[r=mkanat a=mkanat]
parent 6b4e9eda
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
# Lance Larsh <lance.larsh@oracle.com> # Lance Larsh <lance.larsh@oracle.com>
# Jesse Clark <jjclark1982@gmail.com> # Jesse Clark <jjclark1982@gmail.com>
# Rémi Zara <remi_zara@mac.com> # Rémi Zara <remi_zara@mac.com>
# Reed Loden <reed@reedloden.com>
use strict; use strict;
...@@ -614,7 +615,7 @@ sub init { ...@@ -614,7 +615,7 @@ sub init {
"^long_?desc,changedafter" => \&_long_desc_changedbefore_after, "^long_?desc,changedafter" => \&_long_desc_changedbefore_after,
"^content,matches" => \&_content_matches, "^content,matches" => \&_content_matches,
"^content," => sub { ThrowUserError("search_content_without_matches"); }, "^content," => sub { ThrowUserError("search_content_without_matches"); },
"^(?:deadline|creation_ts|delta_ts),(?:lessthan|greaterthan|equals|notequals),(?:-|\\+)?(?:\\d+)(?:[dDwWmMyY])\$" => \&_timestamp_compare, "^(?:deadline|creation_ts|delta_ts),(?:lessthan|lessthaneq|greaterthan|greaterthaneq|equals|notequals),(?:-|\\+)?(?:\\d+)(?:[dDwWmMyY])\$" => \&_timestamp_compare,
"^commenter,(?:equals|anyexact),(%\\w+%)" => \&_commenter_exact, "^commenter,(?:equals|anyexact),(%\\w+%)" => \&_commenter_exact,
"^commenter," => \&_commenter, "^commenter," => \&_commenter,
# The _ is allowed for backwards-compatibility with 3.2 and lower. # The _ is allowed for backwards-compatibility with 3.2 and lower.
...@@ -642,7 +643,7 @@ sub init { ...@@ -642,7 +643,7 @@ sub init {
"^dependson,(?!changed)" => \&_dependson_nonchanged, "^dependson,(?!changed)" => \&_dependson_nonchanged,
"^blocked,(?!changed)" => \&_blocked_nonchanged, "^blocked,(?!changed)" => \&_blocked_nonchanged,
"^alias,(?!changed)" => \&_alias_nonchanged, "^alias,(?!changed)" => \&_alias_nonchanged,
"^owner_idle_time,(greaterthan|lessthan)" => \&_owner_idle_time_greater_less, "^owner_idle_time,(greaterthan|greaterthaneq|lessthan|lessthaneq)" => \&_owner_idle_time_greater_less,
"^($multi_fields),(?:notequals|notregexp|notsubstring|nowords|nowordssubstr)" => \&_multiselect_negative, "^($multi_fields),(?:notequals|notregexp|notsubstring|nowords|nowordssubstr)" => \&_multiselect_negative,
"^($multi_fields),(?:allwords|allwordssubstr|anyexact)" => \&_multiselect_multiple, "^($multi_fields),(?:allwords|allwordssubstr|anyexact)" => \&_multiselect_multiple,
"^($multi_fields),(?!changed)" => \&_multiselect_nonchanged, "^($multi_fields),(?!changed)" => \&_multiselect_nonchanged,
...@@ -655,8 +656,10 @@ sub init { ...@@ -655,8 +656,10 @@ sub init {
",regexp" => \&_regexp, ",regexp" => \&_regexp,
",notregexp" => \&_notregexp, ",notregexp" => \&_notregexp,
",lessthan" => \&_lessthan, ",lessthan" => \&_lessthan,
",lessthaneq" => \&_lessthaneq,
",matches" => sub { ThrowUserError("search_content_without_matches"); }, ",matches" => sub { ThrowUserError("search_content_without_matches"); },
",greaterthan" => \&_greaterthan, ",greaterthan" => \&_greaterthan,
",greaterthaneq" => \&_greaterthaneq,
",anyexact" => \&_anyexact, ",anyexact" => \&_anyexact,
",anywordssubstr" => \&_anywordsubstr, ",anywordssubstr" => \&_anywordsubstr,
",allwordssubstr" => \&_allwordssubstr, ",allwordssubstr" => \&_allwordssubstr,
...@@ -1595,8 +1598,12 @@ sub _percentage_complete { ...@@ -1595,8 +1598,12 @@ sub _percentage_complete {
$oper = "="; $oper = "=";
} elsif ($$t eq "greaterthan") { } elsif ($$t eq "greaterthan") {
$oper = ">"; $oper = ">";
} elsif ($$t eq "greaterthaneq") {
$oper = ">=";
} elsif ($$t eq "lessthan") { } elsif ($$t eq "lessthan") {
$oper = "<"; $oper = "<";
} elsif ($$t eq "lessthaneq") {
$oper = "<=";
} elsif ($$t eq "notequal") { } elsif ($$t eq "notequal") {
$oper = "<>"; $oper = "<>";
} elsif ($$t eq "regexp") { } elsif ($$t eq "regexp") {
...@@ -2134,6 +2141,14 @@ sub _lessthan { ...@@ -2134,6 +2141,14 @@ sub _lessthan {
$$term = "$$ff < $$q"; $$term = "$$ff < $$q";
} }
sub _lessthaneq {
my $self = shift;
my %func_args = @_;
my ($ff, $q, $term) = @func_args{qw(ff q term)};
$$term = "$$ff <= $$q";
}
sub _greaterthan { sub _greaterthan {
my $self = shift; my $self = shift;
my %func_args = @_; my %func_args = @_;
...@@ -2142,6 +2157,14 @@ sub _greaterthan { ...@@ -2142,6 +2157,14 @@ sub _greaterthan {
$$term = "$$ff > $$q"; $$term = "$$ff > $$q";
} }
sub _greaterthaneq {
my $self = shift;
my %func_args = @_;
my ($ff, $q, $term) = @func_args{qw(ff q term)};
$$term = "$$ff >= $$q";
}
sub _anyexact { sub _anyexact {
my $self = shift; my $self = shift;
my %func_args = @_; my %func_args = @_;
......
...@@ -34,7 +34,9 @@ ...@@ -34,7 +34,9 @@
"regexp", "regexp",
"notregexp", "notregexp",
"lessthan", "lessthan",
"lessthaneq",
"greaterthan", "greaterthan",
"greaterthaneq",
"anywords", "anywords",
"allwords", "allwords",
"nowords", "nowords",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment