]> git.sesse.net Git - ccbs/commitdiff
Add a "total score" for each player the score screen.
authorSteinar H. Gunderson <sesse@samfundet.no>
Mon, 14 Feb 2005 14:13:47 +0000 (14:13 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Mon, 14 Feb 2005 14:13:47 +0000 (14:13 +0000)
html/show-tournament.pl
html/templates/show-tournament.tmpl

index 8d6dc45009d8bf8ce86652cf7fd1bb9253f1a958..b204270422048e58ee57d461c324df362a509efb 100755 (executable)
@@ -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();
index 9588c529df51605045524b57c9ca2d8213239b8e..733b1cfc8e64d37c8566fd6f7220f5b0f456d757 100644 (file)
@@ -36,6 +36,9 @@
 [% FOR s = p.songs %]
       <th>[% s %]</th>
 [% END %]
+[% IF p.num_songs > 1 %]
+      <th>Total</th>
+[% END %]      
     </tr>
     
 [% FOR pl = p.players %]
 [% IF s.chosen %]
         : [% s.title %]
 [% END %]
-</td>
+      </td>
 [% END %]
+[% IF p.num_songs > 1 %]
+     <td>[% pl.total %]</td>
+[% END %]      
     </tr>
 [% END %]
   </table>