]> git.sesse.net Git - ccbs/commitdiff
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 c8be12d46c4912532b1cb8cb759413c9e3dec6c2..68abcead5faa759e7c49fed8f2563a4bbd79e6d2 100755 (executable)
@@ -9,7 +9,7 @@ my $machine = $cgi->param('machine');
 
 my $dbh = ccbs::db_connect();
 
 
 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 = ();
 
 
 my @songs = ();
 
@@ -17,7 +17,7 @@ my $last_song = -1;
 my $show_challenge = 0;
 for my $song (@$songs_raw) {
        if ($song->{'song'} != $last_song) {
 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'};
        }
 
        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,
 ccbs::print_header();
 ccbs::process_template('songratings.tmpl', 'Sanger', {
        songs => \@songs,
+       show_challenge => $show_challenge
 });
 $dbh->disconnect;
 });
 $dbh->disconnect;
index 5297c71bbbaf98198bd183601db64363482b9ca7..d5a6bd66a58aea97d20d3480fd0916ae5bd653c0 100644 (file)
@@ -3,7 +3,7 @@
   <div>
     <table class="scores">
       <tr>
   <div>
     <table class="scores">
       <tr>
-        <th></th>
+        <th colspan="2"></th>
 [% IF show_challenge %]        
        <th colspan="5">Single</th>
        <th colspan="4">Double</th>
 [% IF show_challenge %]        
        <th colspan="5">Single</th>
        <th colspan="4">Double</th>
@@ -14,6 +14,7 @@
       </tr>
       <tr>
         <th>Sang</th>
       </tr>
       <tr>
         <th>Sang</th>
+        <th>Artist</th>
         <th>B</th>
         <th>S</th>
         <th>D</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>
 [% 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>
         <td>[% s.single_beginner %]</td>
         <td>[% s.single_standard %]</td>
         <td>[% s.single_difficult %]</td>