]> git.sesse.net Git - ccbs/commitdiff
Show ranking list on the web interface.
authorSteinar H. Gunderson <sesse@samfundet.no>
Mon, 14 Feb 2005 02:37:43 +0000 (02:37 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Mon, 14 Feb 2005 02:37:43 +0000 (02:37 +0000)
00:00-03:30

html/show-tournament.pl
html/templates/show-tournament.tmpl

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 $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)
 
 # 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::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;
 $dbh->disconnect;
index 46a169c3bbd1c71c5f71f13596f288bcb614ebab..9588c529df51605045524b57c9ca2d8213239b8e 100644 (file)
     <li>Scoresystem: [% tournament.scoringsystemname %]</li>
   </ul>
 
     <li>Scoresystem: [% tournament.scoringsystemname %]</li>
   </ul>
 
+  <h2>Rankingliste</h2>
+
+  <ul>
+[% FOR r = rankings %]
+[% IF r.points == -1 %]
+    <li>[% r.ranking %]. plass: [% r.nick %]</li>
+[% ELSE %]
+    <li>[% r.ranking %]. plass: [% r.nick %], med [% r.points %] poeng.</li>
+[% END %]
+[% END %]
+  </ul>
+
 [% FOR r = rounds %]
   <h2>Runde [% r.round %]</h2>
 
 [% FOR r = rounds %]
   <h2>Runde [% r.round %]</h2>