]> git.sesse.net Git - ccbs/blobdiff - html/show-tournament.pl
Show ranking list on the web interface.
[ccbs] / html / show-tournament.pl
index 9b987a06a1d4f26739066329be5c79071df50801..8d6dc45009d8bf8ce86652cf7fd1bb9253f1a958 100755 (executable)
@@ -10,6 +10,7 @@ my $id = $cgi->param('id');
 my $dbh = ccbs::db_connect();
 
 my $tournament = $dbh->selectrow_hashref('SELECT * FROM tournaments NATURAL JOIN seasons NATURAL JOIN countries NATURAL JOIN machines NATURAL JOIN scoringsystems WHERE tournament=?', undef, $id);
+my $rankings = ccbs::db_fetch_all($dbh, 'SELECT ranking,nick,COALESCE(points,-1) AS points FROM tournamentrankings NATURAL JOIN players WHERE tournament=? ORDER BY ranking', $id);
 
 # Swoop all the data in in a big join, then order it over to quasi-sane Perl objects.
 # (round -> parallel -> player -> songs -> title,chosen,score)
@@ -59,5 +60,9 @@ for my $score (@$scores) {
 }
 
 ccbs::print_header();
-ccbs::process_template('show-tournament.tmpl', $tournament->{'tournamentname'}, { tournament => $tournament, rounds => \@rounds });
+ccbs::process_template('show-tournament.tmpl', $tournament->{'tournamentname'}, {
+       tournament => $tournament,
+       rankings => $rankings,
+       rounds => \@rounds
+});
 $dbh->disconnect;