From 682984b549e3e4d53ebe5cc50202226445cf4e60 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Mon, 14 Feb 2005 14:13:47 +0000 Subject: [PATCH] Add a "total score" for each player the score screen. --- html/show-tournament.pl | 6 ++++-- html/templates/show-tournament.tmpl | 8 +++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/html/show-tournament.pl b/html/show-tournament.pl index 8d6dc45..b204270 100755 --- a/html/show-tournament.pl +++ b/html/show-tournament.pl @@ -30,7 +30,7 @@ for my $score (@$scores) { my $p = $rounds[$#rounds]->{'parallels'}; if ($score->{'parallel'} != $parallel) { $parallel = $score->{'parallel'}; - push @$p, { parallel => $parallel, players => [], songs => [] }; + push @$p, { parallel => $parallel, players => [], songs => [], num_songs => 0 }; $player = ''; # Information on songs is not selected from roundrandomsongs etc., @@ -43,12 +43,13 @@ for my $score (@$scores) { } else { push @{$p->[$#$p]->{'songs'}}, $score->{'title'}; } + $p->[$#$p]->{'num_songs'}++; } my $pl = $p->[$#$p]->{'players'}; if ($score->{'nick'} ne $player) { $player = $score->{'nick'}; - push @$pl, { nick => $player, songs => [] }; + push @$pl, { nick => $player, songs => [], total => 0 }; } @@ -57,6 +58,7 @@ for my $score (@$scores) { chosen => $score->{'chosen'}, score => $score->{'score'} }; + $pl->[$#$pl]->{'total'} += $score->{'score'}; } ccbs::print_header(); diff --git a/html/templates/show-tournament.tmpl b/html/templates/show-tournament.tmpl index 9588c52..733b1cf 100644 --- a/html/templates/show-tournament.tmpl +++ b/html/templates/show-tournament.tmpl @@ -36,6 +36,9 @@ [% FOR s = p.songs %] [% s %] [% END %] +[% IF p.num_songs > 1 %] + Total +[% END %] [% FOR pl = p.players %] @@ -47,8 +50,11 @@ [% IF s.chosen %] : [% s.title %] [% END %] - + [% END %] +[% IF p.num_songs > 1 %] + [% pl.total %] +[% END %] [% END %] -- 2.39.2