From: Steinar H. Gunderson Date: Mon, 14 Feb 2005 01:27:05 +0000 (+0000) Subject: Add headings to the score display. X-Git-Url: https://git.sesse.net/?p=ccbs;a=commitdiff_plain;h=660a220456f2ce18077b86a8838259457dad38da Add headings to the score display. --- diff --git a/html/show-tournament.pl b/html/show-tournament.pl index 999ea10..c359511 100755 --- a/html/show-tournament.pl +++ b/html/show-tournament.pl @@ -14,7 +14,7 @@ my $tournament = $dbh->selectrow_hashref('SELECT * FROM tournaments WHERE tourna # 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,nick,title,chosen,score FROM scores NATURAL JOIN players NATURAL JOIN songs NATURAL JOIN roundparticipation WHERE tournament=? ORDER BY round,parallel,position,songnumber', + 'SELECT round,parallel,position,nick,title,chosen,score FROM scores NATURAL JOIN players NATURAL JOIN songs NATURAL JOIN roundparticipation WHERE tournament=? ORDER BY round,parallel,position,songnumber', $id); my @rounds = (); @@ -29,13 +29,26 @@ for my $score (@$scores) { my $p = $rounds[$#rounds]->{'parallels'}; if ($score->{'parallel'} != $parallel) { $parallel = $score->{'parallel'}; - push @$p, { parallel => $parallel, players => [] }; + push @$p, { parallel => $parallel, players => [], songs => [] }; $player = ''; + + # Information on songs is not selected from roundrandomsongs etc., + # but is filled in the first time the song is seen for this round + # (ie. below) + } + if ($score->{'position'} == 1) { + if ($score->{'chosen'}) { + push @{$p->[$#$p]->{'songs'}}, ''; + } else { + push @{$p->[$#$p]->{'songs'}}, $score->{'title'}; + } } + my $pl = $p->[$#$p]->{'players'}; if ($score->{'nick'} ne $player) { $player = $score->{'nick'}; push @$pl, { nick => $player, songs => [] }; + } push @{$pl->[$#$pl]->{'songs'}}, { diff --git a/html/templates/show-tournament.tmpl b/html/templates/show-tournament.tmpl index b17b39b..df259ef 100644 --- a/html/templates/show-tournament.tmpl +++ b/html/templates/show-tournament.tmpl @@ -3,11 +3,18 @@

Runde [% r.round %]

[% FOR p = r.parallels %] -[% IF p.parallel != 0 %] -

Gruppe [% p.parallel %]

-[% END %] - + +[% IF p.parallel == 0 %] + +[% ELSE %] + +[% END %] +[% FOR s = p.songs %] + +[% END %] + + [% FOR pl = p.players %]
Gruppe [% p.parallel %][% s %]
[% pl.nick %]