]> git.sesse.net Git - wloh/blobdiff - www/index.pl
Fix a reference to the variable in wrong scope.
[wloh] / www / index.pl
index 0e8a5a16dcf5d4ce753469fc56b5b73873a0b5c7..c26f12892168ef5702e47404d1e0dde34df32667 100755 (executable)
@@ -307,9 +307,9 @@ sub find_avg_rating {
 
        my $sum_rating = 0.0;
        for my $r (values %$ratings) {
-               $sum_rating += $r;
+               $sum_rating += ($r // 500.0);
        }
-       return $sum_rating / scalar keys %ratings;
+       return $sum_rating / scalar keys %$ratings;
 }
 
 sub get_auxillary_parameters {
@@ -334,12 +334,19 @@ sub print_header {
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="no">
   <head>
     <title>$title</title>
-    <link rel="stylesheet" href="/style" type="text/css" />
+    <link rel="stylesheet" href="style" type="text/css" />
   </head>
   <body>
 EOF
 }
 
+sub get_locale {
+       my $cgi = shift;
+       my $url = $cgi->url(-absolute => 1);
+       $url =~ m#^/([a-z][a-z]-[A-Z][A-Z])/# or die "Invalid locale!";
+       return $1;
+}
+
 sub print_footer {
        print <<"EOF";
   </body>
@@ -424,7 +431,7 @@ EOF
 
        print <<"EOF";
     <p style="clear: both; padding-top: 1em;">Under er en variant som tar relativ spillestyrke med i beregningen;
-      se <a href="/rating">ratingsiden</a>.</p>
+      se <a href="rating">ratingsiden</a>.</p>
 EOF
 
        make_table($aux_parms, $match_stddev, $lowest_division, \%ratings, $cov, $division, $subdivision);