X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=html%2Fshow-tournament.pl;h=7d0d608ad9ccc1fa949bf75c212c8ed6031543fb;hb=8605d403534d6a2015750a7a5c9cb2cc9e3b900a;hp=b02033d3ac925525fe0da1637791246e5b43a417;hpb=e72e054eb8a6d24518ee1d7f9f6c3d2b123353b0;p=ccbs diff --git a/html/show-tournament.pl b/html/show-tournament.pl index b02033d..7d0d608 100755 --- a/html/show-tournament.pl +++ b/html/show-tournament.pl @@ -16,7 +16,7 @@ my $songs = ccbs::db_fetch_all($dbh, 'SELECT song,title FROM machinesongs NATURA # 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) my $scores = ccbs::db_fetch_all($dbh, - 'SELECT round,parallel,position,songnumber,nick,song,title,chosen,score FROM roundparticipation NATURAL JOIN players NATURAL JOIN scores NATURAL LEFT JOIN songs WHERE tournament=? ORDER BY round,parallel,position,songnumber', + 'SELECT round,parallel,position,playmode,difficulty,songnumber,player,nick,song,title,chosen,score FROM roundparticipation NATURAL JOIN players NATURAL JOIN scores NATURAL LEFT JOIN songs WHERE tournament=? ORDER BY round,parallel,position,songnumber', $id); my @rounds = (); @@ -50,21 +50,25 @@ for my $score (@$scores) { my $pl = $p->[$#$p]->{'players'}; if ($score->{'nick'} ne $player) { $player = $score->{'nick'}; - push @$pl, { nick => $player, songs => [], total => 0, locked => 1 }; + push @$pl, { player => $score->{'player'}, nick => $player, songs => [], total => 0 }; } push @{$pl->[$#$pl]->{'songs'}}, $score; if (defined($score->{'score'})) { $pl->[$#$pl]->{'total'} += $score->{'score'}; - } else { - $pl->[$#$pl]->{'locked'} = 0; } } my $num_rounds = scalar @rounds; my $num_rankings = scalar @$rankings; +# Lock all rounds but the last (active?) one +for my $r (0..$#rounds-1) { + $rounds[$r]->{'locked'} = 1; +} +$rounds[$#rounds]->{'locked'} = 0; + # 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;