From: Steinar H. Gunderson Date: Mon, 14 Feb 2005 19:32:16 +0000 (+0000) Subject: Hide rankinglist if there is none. Count the number of qualified for next round. X-Git-Url: https://git.sesse.net/?p=ccbs;a=commitdiff_plain;h=54911b5a3fc854f29196895b5820ad6091001427 Hide rankinglist if there is none. Count the number of qualified for next round. --- diff --git a/html/show-tournament.pl b/html/show-tournament.pl index 87df626..57bd379 100755 --- a/html/show-tournament.pl +++ b/html/show-tournament.pl @@ -62,12 +62,26 @@ for my $score (@$scores) { } my $num_rounds = scalar @rounds; +my $num_rankings = scalar @$rankings; + +# If there have been no rounds, check out the number of participants; if not, check the +# number of qualified from the last round +my $num_qualified; +if ($num_rounds == 0) { + my $ref = $dbh->selectrow_hashref('SELECT COUNT(*) AS num_participants FROM tournamentparticipation WHERE tournament=?', undef, $id); + $num_qualified = $ref->{'num_participants'}; +} else { + my $ref = $dbh->selectrow_hashref('SELECT numqualifying FROM roundparticipation WHERE tournament=? AND round=?', undef, $id, $num_rounds); + $num_qualified = $ref->{'numqualifying'}; +} ccbs::print_header(); ccbs::process_template('show-tournament.tmpl', $tournament->{'tournamentname'}, { tournament => $tournament, rankings => $rankings, + num_rankings => $num_rankings, rounds => \@rounds, - num_rounds => $num_rounds + num_rounds => $num_rounds, + num_qualified => $num_qualified }); $dbh->disconnect; diff --git a/html/templates/show-tournament.tmpl b/html/templates/show-tournament.tmpl index fac6ed0..ad3a8e9 100644 --- a/html/templates/show-tournament.tmpl +++ b/html/templates/show-tournament.tmpl @@ -42,6 +42,7 @@ +[% IF num_rankings > 0 %]

Rankingliste

@@ -55,6 +56,7 @@ [% END %]
+[% END %] [% FOR r = rounds %]

Runde [% r.round %]