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