]> git.sesse.net Git - ccbs/blob - html/players.pl
Merge branch 'mainline-0.1' of /srv/git.sesse.net/private/ccbs into mainline-0.1
[ccbs] / html / players.pl
1 #! /usr/bin/perl
2
3 use ccbs;
4 use strict;
5 use warnings;
6
7 my $cgi = new CGI;
8 my $id = $cgi->param('id');
9
10 my $dbh = ccbs::db_connect();
11
12 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)');
13
14 ccbs::print_header();
15 ccbs::process_template('players.tmpl', _('Players'), {
16         players => $players,
17 });
18 $dbh->disconnect;