admin web: in "result summary in last X", don't include delayed-file-delete jobs

The config option <delete_delay_hours> lets you defer file deletion.
If you set this, say, for 10 days,
then the "results summary in last 24 hours" page will show
jobs that finished 10 days ago and were file-deleted in the last day.
This is generally not what you want.
Change things so that in this case file-deleted results
are treated as if their mod time were 10 days earlier.

Note: this means that the counts of file-delete states
won't be meaningful in this case.
This commit is contained in:
David Anderson 2014-10-05 02:17:03 -07:00
parent b1bc33a39b
commit 0805cf87c3
1 changed files with 17 additions and 6 deletions

View File

@ -22,6 +22,7 @@ error_reporting(E_ALL);
ini_set('display_errors', true);
ini_set('display_startup_errors', true);
require_once("../inc/util_basic.inc");
require_once("../inc/result.inc");
class BoincAssignment {
@ -444,20 +445,30 @@ SELECT COUNT(id) AS nTotal,
SUM(case when server_state = '5' and outcome = '3' and client_state = '4' then 1 else 0 end) AS clientstate_uploading,
SUM(case when server_state = '5' and outcome = '3' and client_state = '5' then 1 else 0 end) AS clientstate_uploaded,
SUM(case when server_state = '5' and outcome = '3' and client_state = '6' then 1 else 0 end) AS clientstate_aborted
FROM result WHERE
FROM result WHERE true
";
if ($query_appid) {
$main_query .= "appid=$query_appid and ";
$main_query .= " and appid=$query_appid";
}
if ($query_wuid) {
$main_query .= "workunitid=$query_wuid and ";
$main_query .= " and workunitid=$query_wuid";
}
if ($query_mod_time) {
$main_query .= "mod_time > DATE_SUB( NOW(), INTERVAL $query_mod_time SECOND )+0 and ";
}
$start = time() - $query_mod_time;
$main_query .= "1=1";
// If file deletion is delayed by X,
// subtract X from mod time of file-deleted results.
// Otherwise we'll show lots of irrelevant results
//
$delay = parse_config(get_config(), "<delete_delay_hours>");
if ($delay) {
$start2 = $start - $delay*3600;;
$main_query .= " and ((file_delete_state>1 and mod_time>FROM_UNIXTIME($start2)) or (mod_time>FROM_UNIXTIME($start)))";
} else {
$main_query .= " and mod_time > FROM_UNIXTIME($start)";
}
}
$urlquery = $q->urlquery;
$result = _mysql_query($main_query);