]> git.sesse.net Git - ccbs/commitdiff
Hide rankinglist if there is none. Count the number of qualified for next round.
authorSteinar H. Gunderson <sesse@samfundet.no>
Mon, 14 Feb 2005 19:32:16 +0000 (19:32 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Mon, 14 Feb 2005 19:32:16 +0000 (19:32 +0000)
html/show-tournament.pl
html/templates/show-tournament.tmpl

index 87df626191e301cd01851f47e8b59a2ebd7d7c03..57bd379a16f2a68df1b2430f4bc619e84e7754a7 100755 (executable)
@@ -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;
index fac6ed0a42557ed8a1d1a904e6526ee7a1fdcc6f..ad3a8e9324effa207d7490a44cf2375e99ef144e 100644 (file)
@@ -42,6 +42,7 @@
     </form>
   </div>
 
+[% IF num_rankings > 0 %]
   <h2>Rankingliste</h2>
 
   <div>
@@ -55,6 +56,7 @@
 [% END %]
     </ul>
   </div>
+[% END %]
 
 [% FOR r = rounds %]
   <h2>Runde [% r.round %]</h2>