Sync with --pgweb.
[ccbs] / html / songs.pl
index 6ae2469e7f4787fc3470abe578c43269521adb8e..80c6132ba7b89886e17a462792dd93806a347f1b 100755 (executable)
@@ -9,10 +9,10 @@ my $id = $cgi->param('id');
 
 my $dbh = ccbs::db_connect();
 
-my $songs = ccbs::db_fetch_all($dbh, 'SELECT machinename,song,title,artist,avg_score,stddev_score,high_score,high_score_player,high_score_nick FROM machinesongs NATURAL JOIN songs NATURAL JOIN machines NATURAL LEFT JOIN ( SELECT song,AVG(score)::integer AS avg_score,STDDEV(score)::integer AS stddev_score,MAX(score) AS high_score FROM scores GROUP BY song ) t1 NATURAL LEFT JOIN ( SELECT DISTINCT ON (song) song,player AS high_score_player,nick AS high_score_nick,score AS high_score FROM scores NATURAL JOIN players ORDER BY song,score DESC ) t2 ORDER BY machine,LOWER(title)');
+my $songs = ccbs::db_fetch_all($dbh, 'SELECT machinename,song,title,artist,avg_score,stddev_score,high_score,high_score_player,high_score_nick FROM machinesongs NATURAL JOIN songs NATURAL JOIN machines NATURAL LEFT JOIN ( SELECT song,AVG(score)::integer AS avg_score,STDDEV(score)::integer AS stddev_score FROM scores JOIN tournaments ON scores.tournament=tournaments.tournament WHERE scoringsystem=1 GROUP BY song ) t1 NATURAL LEFT JOIN ( SELECT DISTINCT ON (song) song,player AS high_score_player,nick AS high_score_nick,score AS high_score FROM scores NATURAL JOIN players JOIN tournaments ON scores.tournament=tournaments.tournament WHERE scoringsystem=1 ORDER BY song,score DESC ) t2 ORDER BY machine,LOWER(title)');
 
 ccbs::print_header();
-ccbs::process_template('songs.tmpl', 'Songs', {
+ccbs::process_template('songs.tmpl', 'Sanger', {
        songs => $songs,
 });
 $dbh->disconnect;