Calculate a minflight based on the time limit, and set the time limit
to a year ago by default.

Signed-off-by: Ian Jackson <ian.jack...@eu.citrix.com>
---
 sg-report-job-history | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sg-report-job-history b/sg-report-job-history
index 5d2a7e15..e09c694f 100755
--- a/sg-report-job-history
+++ b/sg-report-job-history
@@ -30,6 +30,7 @@ use Osstest::HistoryReport;
 
 our (@blessings,@branches);
 our $limit= 100;
+our $timelimit= 86400 * (366 + 14);
 our $htmlout = '.';
 our $flight;
 our $maxjobs=10;
@@ -44,6 +45,8 @@ while (@ARGV && $ARGV[0] =~ m/^-/) {
         $$1= $2;
     } elsif (m/^--(limit)\=([1-9]\d*)$/) {
         $$1= $2;
+    } elsif (m/^--time-limit\=([1-9]\d*)$/) {
+        $timelimit= $1;
     } elsif (restrictflight_arg($_)) {
        # Handled by Executive
     } elsif (m/^--html-dir=(.*)$/) {
@@ -67,6 +70,9 @@ csreadconfig();
 
 our @jobs;
 
+our $minflight = minflight_by_time($timelimit);
+print DEBUG "MINFLIGHT $minflight\n";
+
 sub findflight () {
     my $branches= $dbh_tests->selectcol_arrayref(<<END, {}, $flight);
         SELECT branch FROM flights WHERE flight=?
@@ -144,6 +150,7 @@ END
         SELECT * 
           FROM jobs JOIN flights USING (flight)
          WHERE ($cond)
+           AND flight > $minflight
       ORDER BY flight DESC
          LIMIT $limit
 END
-- 
2.11.0


Reply via email to