]> git.sesse.net Git - ccbs/blobdiff - html/songratings.pl
Various songratings.pl fixes from --pgweb.
[ccbs] / html / songratings.pl
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;