]> git.sesse.net Git - ccbs/commitdiff
Link from the player's "all songs" list to the songs.
authorSteinar H. Gunderson <sesse@samfundet.no>
Mon, 4 Apr 2005 01:41:17 +0000 (01:41 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Mon, 4 Apr 2005 01:41:17 +0000 (01:41 +0000)
html/player.pl
html/templates/player.tmpl

index 0fbde00f445ba54436b7951367fe931c746bc722..ce0e7137312fdc3027bdaf89f84b93eab892e4f4 100755 (executable)
@@ -15,13 +15,14 @@ my $bestsongs = ccbs::db_fetch_all($dbh, 'SELECT song,title,score,tournament,tou
 # Fetch all scores and count a bit
 my $columns = 0;
 my @allsongs = ();
-my $last_title = undef;
+my $last_song = undef;
 
-my $scores = ccbs::db_fetch_all($dbh, 'SELECT title,score FROM scores NATURAL JOIN songs WHERE player=? ORDER BY title,score DESC', $id);
+my $scores = ccbs::db_fetch_all($dbh, 'SELECT song,title,score FROM scores NATURAL JOIN songs WHERE player=? ORDER BY title,score DESC', $id);
 for my $score (@$scores) {
-       my $title = $score->{'title'};
-       if (!defined($last_title) || $title ne $last_title) {
-               push @allsongs, { title => $title, scores => [] };
+       my $song = $score->{'song'};
+
+       if (!defined($last_song) || $song != $last_song) {
+               push @allsongs, { song => $song, title => $score->{'title'}, scores => [] };
        }
 
        push @{$allsongs[$#allsongs]->{'scores'}}, $score->{'score'};
@@ -29,7 +30,7 @@ for my $score (@$scores) {
        my $this_columns = scalar @{$allsongs[$#allsongs]->{'scores'}};
        $columns = $this_columns if ($this_columns > $columns);
 
-       $last_title = $title;
+       $last_song = $song;
 }
 
 ccbs::print_header();
index 5f25b8f81b74bcc1b38f7bf87f1ffb4915e0927a..59a15dde0bb28a41c3e49fb94e9517cadac8932c 100644 (file)
@@ -41,7 +41,7 @@
     <table>
 [% FOR s = allsongs %]
       <tr>
-        <th>[% s.title %]</th>
+        <th><a href="song.pl?id=[% s.song %]">[% s.title %]</a></th>
 [% SET col = 0 %]
 [% FOR score = s.scores %]
         <td>[% score %]</td>