Commit 12a601d9 authored by gerv%gerv.net's avatar gerv%gerv.net

Bug 37749 - query for changes to specific field in last n days not working.…

Bug 37749 - query for changes to specific field in last n days not working. Rearrange time-based query UI to be more sane. Patch by mailto:anthony@itia.ntua.gr; r=gerv.
parent 721bb38a
...@@ -213,64 +213,65 @@ sub init { ...@@ -213,64 +213,65 @@ sub init {
} }
} }
# 2003-05-20: The 'changedin' field is no longer in the UI, but we continue
if (defined $params->param('changedin')) { # to process it because it will appear in stored queries and bookmarks.
my $c = trim($params->param('changedin')); my $changedin = $params->param('changedin') || '';
if ($c ne "") { $changedin = trim($changedin);
if ($c !~ /^[0-9]*$/) { if ($changedin) {
if ($changedin !~ /^[0-9]*$/) {
ThrowUserError("illegal_changed_in_last_x_days", ThrowUserError("illegal_changed_in_last_x_days",
{ value => $c }); { value => $changedin });
}
push(@specialchart, ["changedin",
"lessthan", $c + 1]);
} }
push(@specialchart, ["changedin", "lessthan", $changedin + 1]);
} }
my $chfieldfrom = $params->param('chfieldfrom') || '';
my $chfieldto = $params->param('chfieldto') || '';
my @chfield = $params->param('chfield'); my @chfield = $params->param('chfield');
my $chvalue = $params->param('chfieldvalue') || '';
if (@chfield) { my $lcchfieldfrom = trim(lc($chfieldfrom));
my $which = lsearch(\@chfield, "[Bug creation]"); my $lcchfieldto = trim(lc($chfieldto));
if ($which >= 0) { $chvalue = trim($chvalue);
splice(@chfield, $which, 1);
push(@specialchart, ["creation_ts", "greaterthan", $lcchfieldfrom = '' if ($lcchfieldfrom eq 'now');
SqlifyDate($params->param('chfieldfrom'))]); $lcchfieldto = '' if ($lcchfieldto eq 'now');
my $to = $params->param('chfieldto'); if ($lcchfieldfrom ne '' || $lcchfieldto ne '') {
if (defined $to) { my $sql_chfrom = $lcchfieldfrom ? &::SqlQuote(SqlifyDate($lcchfieldfrom)):'';
$to = trim($to); my $sql_chto = $lcchfieldto ? &::SqlQuote(SqlifyDate($lcchfieldto)) :'';
if ($to ne "" && $to !~ /^now$/i) { my $sql_chvalue = $chvalue ne '' ? &::SqlQuote($chvalue) : '';
push(@specialchart, ["creation_ts", "lessthan", if(!@chfield) {
SqlifyDate($to)]); push(@wherepart, "bugs.delta_ts >= $sql_chfrom") if ($sql_chfrom);
} push(@wherepart, "bugs.delta_ts <= $sql_chto") if ($sql_chto);
} } else {
}
}
if (@chfield) {
push(@supptables, "bugs_activity actcheck"); push(@supptables, "bugs_activity actcheck");
my $sql_bugschanged = '';
my @list; my @list;
foreach my $f (@chfield) { foreach my $f (@chfield) {
if ($f eq "[Bug creation]") {
my @l;
push(@l, "creation_ts >= $sql_chfrom") if($sql_chfrom);
push(@l, "creation_ts <= $sql_chto") if($sql_chto);
$sql_bugschanged = "(" . join(' AND ', @l) . ")";
} else {
push(@list, "\nactcheck.fieldid = " . &::GetFieldID($f)); push(@list, "\nactcheck.fieldid = " . &::GetFieldID($f));
} }
push(@wherepart, "actcheck.bug_id = bugs.bug_id");
push(@wherepart, "(" . join(' OR ', @list) . ")");
push(@wherepart, "actcheck.bug_when >= " .
&::SqlQuote(SqlifyDate($params->param('chfieldfrom'))));
my $to = $params->param('chfieldto');
if (defined $to) {
$to = trim($to);
if ($to ne "" && $to !~ /^now$/i) {
push(@wherepart, "actcheck.bug_when <= " .
&::SqlQuote(SqlifyDate($to)));
}
}
my $value = $params->param('chfieldvalue');
if (defined $value) {
$value = trim($value);
if ($value ne "") {
push(@wherepart, "actcheck.added = " .
&::SqlQuote($value))
} }
if(@list) {
$sql_bugschanged .= ' OR ' if($sql_bugschanged ne '');
$sql_bugschanged .= "(actcheck.bug_id = bugs.bug_id AND " .
"(" . join(' OR ', @list) . ")";
if($sql_chfrom) {
$sql_bugschanged .= " AND actcheck.bug_when >= $sql_chfrom";
}
if($sql_chto) {
$sql_bugschanged .= " AND actcheck.bug_when <= $sql_chto";
}
if($sql_chvalue) {
$sql_bugschanged .= " AND actcheck.added = $sql_chvalue";
}
$sql_bugschanged .= ')';
}
push(@wherepart, "($sql_bugschanged)");
} }
} }
......
...@@ -800,28 +800,51 @@ bugs numbered: ...@@ -800,28 +800,51 @@ bugs numbered:
<INPUT TYPE="text" NAME="bug_id" VALUE="" SIZE=15> <INPUT TYPE="text" NAME="bug_id" VALUE="" SIZE=15>
</td> </td>
</tr> </tr>
<tr><td>&nbsp;</td></tr>
<tr> <tr>
<td> <td colspan=2>
Changed in the last <INPUT NAME=changedin SIZE=3 VALUE=""> days Only bugs changed between <INPUT NAME="chfieldfrom" SIZE="10" VALUE="">
and <INPUT NAME="chfieldto" SIZE="10" VALUE="Now">
</td> </td>
</tr> </tr>
<tr> <tr valign="top">
<td> <td>
Containing at least <INPUT NAME=votes SIZE=3 VALUE=""> votes Where one or more of the following changed:
</td><td>
<SELECT NAME="chfield" MULTIPLE SIZE=4>
<OPTION VALUE="[Bug creation]">[Bug creation]
<OPTION VALUE="assigned_to">assigned_to
<OPTION VALUE="bug_file_loc">bug_file_loc
<OPTION VALUE="bug_severity">bug_severity
<OPTION VALUE="bug_status">bug_status
<OPTION VALUE="component">component
<OPTION VALUE="everconfirmed">everconfirmed
<OPTION VALUE="groupset">groupset
<OPTION VALUE="keywords">keywords
<OPTION VALUE="op_sys">op_sys
<OPTION VALUE="priority">priority
<OPTION VALUE="product">product
<OPTION VALUE="qa_contact">qa_contact
<OPTION VALUE="rep_platform">rep_platform
<OPTION VALUE="reporter">reporter
<OPTION VALUE="resolution">resolution
<OPTION VALUE="short_desc">short_desc
<OPTION VALUE="status_whiteboard">status_whiteboard
<OPTION VALUE="target_milestone">target_milestone
<OPTION VALUE="version">version
<OPTION VALUE="votes">votes
</SELECT>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
Where the field(s) and the result was: <INPUT NAME="chfieldvalue" SIZE="10">
<SELECT NAME="chfield" MULTIPLE SIZE=4>
<OPTION VALUE="[Bug creation]">[Bug creation]<OPTION VALUE="assigned_to">assigned_to<OPTION VALUE="bug_file_loc">bug_file_loc<OPTION VALUE="bug_severity">bug_severity<OPTION VALUE="bug_status">bug_status<OPTION VALUE="component">component<OPTION VALUE="everconfirmed">everconfirmed<OPTION VALUE="groupset">groupset<OPTION VALUE="keywords">keywords<OPTION VALUE="op_sys">op_sys<OPTION VALUE="priority">priority<OPTION VALUE="product">product<OPTION VALUE="qa_contact">qa_contact<OPTION VALUE="rep_platform">rep_platform<OPTION VALUE="reporter">reporter<OPTION VALUE="resolution">resolution<OPTION VALUE="short_desc">short_desc<OPTION VALUE="status_whiteboard">status_whiteboard<OPTION VALUE="target_milestone">target_milestone<OPTION VALUE="version">version<OPTION VALUE="votes">votes
</SELECT> changed to <INPUT NAME="chfieldvalue" SIZE="10">
</td> </td>
</tr> </tr>
<tr><td>&nbsp;</td></tr>
<tr> <tr>
<td colspan=2> <td>
During dates <INPUT NAME="chfieldfrom" SIZE="10" VALUE=""> Containing at least <INPUT NAME=votes SIZE=3 VALUE=""> votes
to <INPUT NAME="chfieldto" SIZE="10" VALUE="Now">
</td> </td>
</tr> </tr>
<tr> <tr>
...@@ -847,29 +870,23 @@ exclude bugs based on values you enter. ...@@ -847,29 +870,23 @@ exclude bugs based on values you enter.
of which you want to exclude. It would be nice in the future if you could type in ranges, i.e. [1-1000] for 1 of which you want to exclude. It would be nice in the future if you could type in ranges, i.e. [1-1000] for 1
to 1000. Unfortunately, you cannot do that as of now. to 1000. Unfortunately, you cannot do that as of now.
<p><b>Changed in the last [text] days</b>
<p>Lets you specify how many days ago - at maximum - a bug could have changed state.
<p><b>At least [text] votes</b> <p><b>At least [text] votes</b>
<p>With this, you can choose how many votes - at minimum - a bug has. <p>With this, you can choose how many votes - at minimum - a bug has.
<p><b>Where the field(s) [fields] changed to [text]</b> <a name="changedbetween">
<p><b>Only bugs changed between</b></p>
<p>With this, you can specify values to search for in fields that exist in the bug If you choose <p>Here you can choose what dates the bugs changed. "Now" can be used as an
one or more fields, you have to fill out one of the fields to the right. It might entry. Other entries should be in yyyy-mm-dd format, or in relative dates such
be difficult to figure out what these fields mean if you are a newbie to the query. as 1d or 2w or 3m or 4y, which respectively mean 1 day, 2 weeks, 3 months, 4
They match various fields within the bug information. Optionally, you can years ago. 0d is last midnight, and 0w, 0m, 0y is the beginning of this week,
also enter what value you want the field to have changed to if you only entered one field. month, or year.</p>
For instance, if the bug changed who it was assigned to from jon\@netscape.com
to brian\@netscape.com , you could enter in
assigned_to changed to brian\@netscape.com.
<p><b>During dates [text] to [text] </b> <p><b>Where one or more of the following changed, and the result was</b></p>
<p>Here, you can choose what dates the fields changed. "Now" can be used as an entry. Other entries should be in <p>With this you can specify which bug fields changed, and optionally to what
mm/dd/yyyy or yyyy-mm-dd format. value, between the dates specified above. Leaving blank will match any change.</p>
}; };
......
...@@ -726,12 +726,13 @@ function selectProduct(f) { ...@@ -726,12 +726,13 @@ function selectProduct(f) {
<dl> <dl>
<dt>Only bugs changed in the last </dt> <dt>Only bugs changed between:</dt>
<dd><input name="changedin" size="3" value="[% default.changedin.0 FILTER html %]"> days</dd> <dd>
</dl> <input name="chfieldfrom" size="10" value="[% default.chfieldfrom.0 FILTER html %]">
and <input name="chfieldto" size="10" value="[% default.chfieldto.0 FILTER html %]">
<dl> <br>(YYYY-MM-DD or <a href="queryhelp.cgi#changedbetween">relative dates</a>)
<dt>Only bugs where any of the fields</dt> </dd><br>
<dt>where one or more of the following changed:</dt>
<dd> <dd>
<select name="chfield" multiple="multiple" size="4"> <select name="chfield" multiple="multiple" size="4">
[% FOREACH field = chfield %] [% FOREACH field = chfield %]
...@@ -740,21 +741,13 @@ function selectProduct(f) { ...@@ -740,21 +741,13 @@ function selectProduct(f) {
[% (field_descs.$field || field) FILTER html %]</option> [% (field_descs.$field || field) FILTER html %]</option>
[% END %] [% END %]
</select> </select>
</dd> </dd><br>
<dt>and the new value was:</dt>
<dt>were changed between</dt>
<dd>
<input name="chfieldfrom" size="10" value="[% default.chfieldfrom.0 FILTER html %]">
and <input name="chfieldto" size="10" value="[% default.chfieldto.0 FILTER html %]">
<br>(YYYY-MM-DD)
</dd>
<dt>to this value: (optional)</dt>
<dd> <dd>
<input name="chfieldvalue" size="20" value="[% default.chfieldvalue.0 FILTER html %]"> <input name="chfieldvalue" size="20" value="[% default.chfieldvalue.0 FILTER html %]">
</dd> </dd><br>
</dl> </dl>
</fieldset> </fieldset>
</td> </td>
</tr> </tr>
......
...@@ -81,16 +81,21 @@ ...@@ -81,16 +81,21 @@
{ id => "votes", { id => "votes",
html => "Some bugs can be voted for, and you can limit your search to bugs<br> html => "Some bugs can be voted for, and you can limit your search to bugs<br>
with more than a certain number of votes." }, with more than a certain number of votes." },
{ id => "changedin",
html => "You can search by when bugs have changed - this field defines the<br>
timeframe for the search." },
{ id => "chfield", { id => "chfield",
html => "You can search for specific types of change - this field define <br> html => "You can search for specific types of change - this field define <br>
which field you are interested in changes for." }, which field you are interested in changes for." },
{ id => "chfieldfrom", { id => "chfieldfrom",
html => "The start time of the timeframe for the change." }, html => "Specify the start and end dates either in YYYY-MM-DD format<br>
(optionally followed by HH:mm, in 24 hour clock), or in relative<br>
dates such as 1d, 2w, 3m, 4y, which respectively mean one day,<br>
two weeks, three months, or four years ago. 0d is last midnight,<br>
and 0w, 0m, 0y is the beginning of this week, month, or year." },
{ id => "chfieldto", { id => "chfieldto",
html => "The end time of the timeframe for the change." }, html => "Specify the start and end dates either in YYYY-MM-DD format<br>
(optionally followed by HH:mm, in 24 hour clock), or in relative<br>
dates such as 1d, 2w, 3m, 4y, which respectively mean one day,<br>
two weeks, three months, or four years ago. 0d is last midnight,<br>
and 0w, 0m, 0y is the beginning of this week, month, or year." },
{ id => "chfieldvalue", { id => "chfieldvalue",
html => "The value the field defined above changed to during that time." }, html => "The value the field defined above changed to during that time." },
] %] ] %]
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