]> git.sesse.net Git - wloh/commitdiff
Move get_max_season() into the common package.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 23 Apr 2012 22:41:31 +0000 (00:41 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 23 Apr 2012 22:41:31 +0000 (00:41 +0200)
common.pm
www/index.pl

index 37c59a377e74f4e6cfbff38fb0e14bdb68d1c7cc..7ec01a06e4eee50bb8975329ff0e47f9779bc2b2 100644 (file)
--- a/common.pm
+++ b/common.pm
@@ -4,6 +4,12 @@ use POSIX;
 
 package wloh_common;
 
+sub get_max_season {
+       my $dbh = shift;
+       my $ref = $dbh->selectrow_hashref('SELECT MAX(sesong) AS max_sesong FROM fotballserier');
+       return $ref->{'max_sesong'};
+}
+
 sub output_last_sync {
        my $dbh = shift;
        my $ref = $dbh->selectrow_hashref('SELECT EXTRACT(EPOCH FROM last_sync) AS last_sync FROM last_sync');
index fb4d8ce87034cfd2107729f76ef94c8720ca4c10..109caae89e568f69e70bb1e0ecc47ec3ee6ebe82 100755 (executable)
@@ -39,12 +39,6 @@ sub color {
        return int(255.0 * ($x ** (1.80)));
 }
 
-sub get_max_season {
-       my $dbh = shift;
-       my $ref = $dbh->selectrow_hashref('SELECT MAX(sesong) AS max_sesong FROM fotballserier');
-       return $ref->{'max_sesong'};
-}
-
 sub get_divisions {
        my ($dbh, $season) = @_;
 
@@ -361,7 +355,7 @@ my $subdivision = $cgi->param('avdeling') // -1;
 my $match_player = $cgi->param('spiller');
 my $match_position = $cgi->param('posisjon');
 
-my $season = get_max_season($dbh);
+my $season = wloh_common::get_max_season($dbh);
 my @divisions = get_divisions($dbh, $season);
 $division = 1 if (!grep { $_ == $division } @divisions);
 my @subdivisions = get_subdivisions($dbh, $season, $division);