Various songratings.pl fixes from --pgweb.
authorSteinar H. Gunderson <sesse@samfundet.no>
Thu, 7 Apr 2005 14:38:47 +0000 (14:38 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Thu, 7 Apr 2005 14:38:47 +0000 (14:38 +0000)
Patches applied:

 * sgunderson@bigfoot.com--2005-private/ccbs--pgweb--1.0--patch-29
   Fix a bug where challenge would never be shown.

 * sgunderson@bigfoot.com--2005-private/ccbs--pgweb--1.0--patch-30
   Order the song ratings list by title, not internal song number.

 * sgunderson@bigfoot.com--2005-private/ccbs--pgweb--1.0--patch-31
   Show artist names in the song ratings.

html/songratings.pl
html/templates/songratings.tmpl

index c8be12d..68abcea 100755 (executable)
@@ -9,7 +9,7 @@ my $machine = $cgi->param('machine');
 
 my $dbh = ccbs::db_connect();
 
-my $songs_raw = ccbs::db_fetch_all($dbh, 'SELECT song,title,playmode,difficulty,feetrating FROM songratings NATURAL JOIN songs WHERE machine=? ORDER BY machine,song', $machine);
+my $songs_raw = ccbs::db_fetch_all($dbh, 'SELECT song,title,artist,playmode,difficulty,feetrating FROM songratings NATURAL JOIN songs WHERE machine=? ORDER BY LOWER(title)', $machine);
 
 my @songs = ();
 
@@ -17,7 +17,7 @@ my $last_song = -1;
 my $show_challenge = 0;
 for my $song (@$songs_raw) {
        if ($song->{'song'} != $last_song) {
-               push @songs, { song => $song->{'song'}, title => $song->{'title'} };
+               push @songs, { song => $song->{'song'}, title => $song->{'title'}, artist => $song->{'artist'} };
        }
 
        my $key = $song->{'playmode'} . '_' . $song->{'difficulty'};
@@ -30,5 +30,6 @@ for my $song (@$songs_raw) {
 ccbs::print_header();
 ccbs::process_template('songratings.tmpl', 'Sanger', {
        songs => \@songs,
+       show_challenge => $show_challenge
 });
 $dbh->disconnect;
index 5297c71..d5a6bd6 100644 (file)
@@ -3,7 +3,7 @@
   <div>
     <table class="scores">
       <tr>
-        <th></th>
+        <th colspan="2"></th>
 [% IF show_challenge %]        
        <th colspan="5">Single</th>
        <th colspan="4">Double</th>
@@ -14,6 +14,7 @@
       </tr>
       <tr>
         <th>Sang</th>
+        <th>Artist</th>
         <th>B</th>
         <th>S</th>
         <th>D</th>
@@ -31,6 +32,7 @@
 [% FOR s = songs %]
       <tr>
         <td><a href="song.pl?id=[% s.song %]">[% s.title %]</a></td>
+        <td>[% s.artist %]</td>
         <td>[% s.single_beginner %]</td>
         <td>[% s.single_standard %]</td>
         <td>[% s.single_difficult %]</td>