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');
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;
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));
}
} 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>