]> git.sesse.net Git - ccbs/blobdiff - html/show-tournament.pl
Fix showing of newly created rounds again.
[ccbs] / html / show-tournament.pl
index 230621bba7294f51edd67df4efc7689fce82a906..0a59d71c9af14cfa0cd5c81386990730a42381ab 100755 (executable)
@@ -71,6 +71,9 @@ for my $score (@$scores) {
        }
 }
 
+# FIXME: In some odd cases, there _might_ be an empty group right at the end. Fix this when
+#        we are able to add/delete people in groups.
+
 my $num_rounds = scalar @rounds;
 my $num_rankings = scalar @$rankings;
 
@@ -81,7 +84,7 @@ for my $r (0..$#rounds-1) {
 
 # If there's only one group left and it's valid for closing, we can also finish
 # the entire tournament if we'd like
-if ($closing_valid && (scalar @{$rounds[$#rounds]->{'parallels'}}) == 1) {
+if ($closing_valid && (scalar @rounds > 0 && scalar @{$rounds[$#rounds]->{'parallels'}}) == 1) {
        $finishing_valid = 1;
 }
 
@@ -96,6 +99,14 @@ if ($num_rounds == 0) {
        $num_qualified = $ref->{'numqualifying'};
 }
 
+# And last: If there is a ranking list, the tournament is closed and we really can't
+# do anything more
+if ($num_rankings > 0) {
+       $closing_valid = 0;
+       $finishing_valid = 0;
+       $rounds[$#rounds]->{'locked'} = 1;
+}
+
 ccbs::print_header();
 ccbs::process_template('show-tournament.tmpl', $tournament->{'tournamentname'}, {
        tournament => $tournament,