X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=www%2Findex.pl;h=7546d658ac8a4b5bf14bf8a30b8e46d408c4092b;hb=854c8eb6e0a3f9836043faaf2f43c05c190619fb;hp=506faf52ab0e4667d4c13b4420e916790f998954;hpb=6d4b847681777889d8f9defe34f6d72ed8ae9585;p=wloh diff --git a/www/index.pl b/www/index.pl index 506faf5..7546d65 100755 --- a/www/index.pl +++ b/www/index.pl @@ -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));