From 34050d5b545b678e2af2980657d0f90a9d9de521 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Mon, 4 Apr 2005 01:41:17 +0000 Subject: [PATCH 1/1] Link from the player's "all songs" list to the songs. --- html/player.pl | 13 +++++++------ html/templates/player.tmpl | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/html/player.pl b/html/player.pl index 0fbde00..ce0e713 100755 --- a/html/player.pl +++ b/html/player.pl @@ -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(); diff --git a/html/templates/player.tmpl b/html/templates/player.tmpl index 5f25b8f..59a15dd 100644 --- a/html/templates/player.tmpl +++ b/html/templates/player.tmpl @@ -41,7 +41,7 @@ [% FOR s = allsongs %] - + [% SET col = 0 %] [% FOR score = s.scores %] -- 2.39.2
[% s.title %][% s.title %][% score %]