Sync with --pgweb.
authorSteinar H. Gunderson <sesse@samfundet.no>
Tue, 5 Apr 2005 01:45:40 +0000 (01:45 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Tue, 5 Apr 2005 01:45:40 +0000 (01:45 +0000)
Patches applied:

 * sgunderson@bigfoot.com--2005-private/ccbs--pgweb--1.0--patch-27
   For the totals of players and songs, only count scores with scoringsystem = MS 10K score.

html/players.pl
html/songs.pl

index dcce199..021b6ea 100755 (executable)
@@ -9,7 +9,7 @@ my $id = $cgi->param('id');
 
 my $dbh = ccbs::db_connect();
 
-my $players = ccbs::db_fetch_all($dbh, 'SELECT player,nick,countryname,clubname,count(*) AS num_songs,COUNT(DISTINCT song) AS num_unique_songs,COUNT(DISTINCT tournament) AS num_tournaments,AVG(score)::integer AS avg_score,MAX(score) AS high_score FROM scores NATURAL JOIN players NATURAL JOIN countries NATURAL LEFT JOIN clubs GROUP BY player,nick,countryname,clubname ORDER BY LOWER(nick)');
+my $players = ccbs::db_fetch_all($dbh, 'SELECT scores.player,nick,countryname,clubname,count(*) AS num_songs,COUNT(DISTINCT song) AS num_unique_songs,COUNT(DISTINCT tournament) AS num_tournaments,AVG(score)::integer AS avg_score,MAX(score) AS high_score FROM scores NATURAL JOIN tournaments JOIN players ON scores.player=players.player JOIN countries ON players.country=countries.country NATURAL LEFT JOIN clubs WHERE scoringsystem=1 GROUP BY scores.player,nick,countryname,clubname ORDER BY LOWER(nick)');
 
 ccbs::print_header();
 ccbs::process_template('players.tmpl', 'Spillere', {
index b140873..80c6132 100755 (executable)
@@ -9,7 +9,7 @@ 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', 'Sanger', {