From cec2dc50dba0555927a1c19cfc0126955e7713dc Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Wed, 13 Jun 2012 15:45:29 +0200 Subject: [PATCH] Increase the expiry time for the ratings page, and rely on clearing it explicitly after sync instead. --- include/common.pm | 13 +++++++++++++ train.pl | 16 ++-------------- www/rating.pl | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/include/common.pm b/include/common.pm index 9348b15..207bfe9 100644 --- a/include/common.pm +++ b/include/common.pm @@ -161,4 +161,17 @@ sub get_ordinal { } } +sub find_all_locales { + my $dbh = shift; + my $q = $dbh->prepare('SELECT kultur FROM fotballspraak WHERE nyestesesong<>-1'); + $q->execute; + + my @locales = (); + while (my $ref = $q->fetchrow_hashref) { + push @locales, $ref->{'kultur'}; + } + + return @locales; +} + 1; diff --git a/train.pl b/train.pl index e3b106b..84335e1 100755 --- a/train.pl +++ b/train.pl @@ -6,6 +6,7 @@ no warnings qw(once); use POSIX; use lib qw( include ); require 'config.pm'; +require 'common.pm'; # Find last completely done season sub find_last_season { @@ -79,19 +80,6 @@ sub train_model { close RATINGS; } -sub find_all_locales { - my $dbh = shift; - my $q = $dbh->prepare('SELECT kultur FROM fotballspraak WHERE nyestesesong<>-1'); - $q->execute; - - my @locales = (); - while (my $ref = $q->fetchrow_hashref) { - push @locales, $ref->{'kultur'}; - } - - return @locales; -} - my $dbh = DBI->connect($config::local_connstr, $config::local_username, $config::local_password) or die "connect: " . $DBI::errstr; $dbh->{AutoCommit} = 0; @@ -99,7 +87,7 @@ $dbh->{RaiseError} = 1; $dbh->do('SET client_min_messages TO WARNING'); -my @locales = find_all_locales($dbh); +my @locales = wloh_common::find_all_locales($dbh); my @ratings = (); my @covariances = (); diff --git a/www/rating.pl b/www/rating.pl index fa1eb9d..5572315 100755 --- a/www/rating.pl +++ b/www/rating.pl @@ -97,7 +97,7 @@ while (my $ref = $q->fetchrow_hashref) { push @players, \%player; } -print CGI->header(-type=>'text/html; charset=utf-8', -expires=>'+5m'); +print CGI->header(-type=>'text/html; charset=utf-8', -expires=>'+75m'); wloh_common::process_template('rating', $locale, { '#navbar' => wloh_common::get_navbar($cgi, $dbh, $locale), 'iterations' => $aux_parms->{'num_iterations'}, -- 2.39.2