]> git.sesse.net Git - wloh/blobdiff - www/index.pl
Don't print navbar in scenario iframe.
[wloh] / www / index.pl
index 506faf52ab0e4667d4c13b4420e916790f998954..cfeead2c2e7e2345c6f1388f7dfa9f5c513d5e3f 100755 (executable)
@@ -313,27 +313,6 @@ sub find_avg_rating {
        return $sum_rating / scalar keys %$ratings;
 }
 
-sub get_auxillary_parameters {
-       my ($dbh) = @_;
-
-       my %aux_parm_names = {
-               -1 => num_iterations,
-               -2 => score_stddev,
-               -3 => rating_prior_stddev,
-               -4 => total_log_likelihood,
-       };
-
-       my $q = $dbh->prepare('SELECT * FROM ratings WHERE id < 0');
-       $q->execute;
-
-       my $aux_parms = {};
-       while (my $ref = $q->fetchrow_hashref) {
-               my $id = $ref->{'id'};
-               $aux_parms->{$aux_parm_names{$id}} = $ref->{'rating'};
-       }
-       return $aux_parms;
-}
-
 sub print_header {
        my ($cgi, $title) = @_;
        print $cgi->header(-type=>'text/html; charset=utf-8', -expires=>'now');
@@ -358,7 +337,8 @@ sub print_footer {
 EOF
 }
 
-my $aux_parms = get_auxillary_parameters($dbh);
+my $locale = wloh_common::get_locale($cgi);
+my $aux_parms = wloh_common::get_auxillary_parameters($dbh, $locale);
 my $match_stddev = $aux_parms->{'score_stddev'} * sqrt(2.0);
 
 my $division = $cgi->param('divisjon') // -1;
@@ -366,7 +346,6 @@ my $subdivision = $cgi->param('avdeling') // -1;
 my $match_player = $cgi->param('spiller');
 my $match_position = $cgi->param('posisjon');
 
-my $locale = wloh_common::get_locale($cgi);
 my $season = wloh_common::get_max_season($dbh, $locale);
 die "Nonexistent locale!" if (!defined($season));
 
@@ -415,6 +394,7 @@ if (defined($match_player) && defined($match_position)) {
        }
 } else {
        POSIX::setlocale(&POSIX::LC_ALL, 'nb_NO.UTF-8');
+       wloh_common::print_navbar($cgi, $dbh, $locale);
        printf <<"EOF", $match_stddev;
     <h1>WLoH-plasseringsannsynlighetsberegning</h1>