Ignore old clock positions from the database.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 27 Dec 2017 10:45:46 +0000 (11:45 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 27 Dec 2017 10:47:05 +0000 (11:47 +0100)
remoteglot.pl

index 00e4707..19f0446 100755 (executable)
@@ -1275,7 +1275,7 @@ sub find_clock_start {
        }
 
        my $id = id_for_pos($pos);
-       my $clock_info = $dbh->selectrow_hashref('SELECT * FROM clock_info WHERE id=?', undef, $id);
+       my $clock_info = $dbh->selectrow_hashref('SELECT * FROM clock_info WHERE id=? AND COALESCE(white_clock_target, black_clock_target) >= EXTRACT(EPOCH FROM (CURRENT_TIMESTAMP - INTERVAL \'1 day\'));', undef, $id);
        if (defined($clock_info)) {
                $pos->{'white_clock'} //= $clock_info->{'white_clock'};
                $pos->{'black_clock'} //= $clock_info->{'black_clock'};