From 72e8701616aa19bc47b5448b8af1b7c1645510f5 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 21 Oct 2007 13:52:50 +0200 Subject: [PATCH 1/1] Show the number of games. --- www/index.pl | 6 ++++-- www/index.xml | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/www/index.pl b/www/index.pl index c1ab7d1..9d43975 100755 --- a/www/index.pl +++ b/www/index.pl @@ -10,7 +10,7 @@ my $dbh = foosball::db_connect(); # Single score board (whoa, inefficient) my @single_top = (); -my $q = $dbh->prepare('select username from users'); +my $q = $dbh->prepare('select username,count(*) as num_games from single_rating group by username'); $q->execute(); while (my $ref = $q->fetchrow_hashref) { my $username = $ref->{'username'}; @@ -30,13 +30,14 @@ while (my $ref = $q->fetchrow_hashref) { 'rd' => foosball::round($rd), 'lowerbound' => foosball::round($rating - 3.0*$rd), 'trend' => $trend, + 'numgames' => $ref->{'num_games'}, }; } @single_top = sort { $b->{'lowerbound'} <=> $a->{'lowerbound'} } @single_top; # Double score board my @double_top = (); -$q = $dbh->prepare('select username from users'); +$q = $dbh->prepare('select username,count(*) as num_games from double_rating group by username'); $q->execute(); while (my $ref = $q->fetchrow_hashref) { my $username = $ref->{'username'}; @@ -56,6 +57,7 @@ while (my $ref = $q->fetchrow_hashref) { 'rd' => foosball::round($rd), 'lowerbound' => foosball::round($rating - 3.0*$rd), 'trend' => $trend, + 'numgames' => $ref->{'num_games'}, }; } @double_top = sort { $b->{'lowerbound'} <=> $a->{'lowerbound'} } @double_top; diff --git a/www/index.xml b/www/index.xml index a1b2488..b7297cc 100644 --- a/www/index.xml +++ b/www/index.xml @@ -128,6 +128,7 @@ Rating RD Bound + Games Change @@ -137,6 +138,7 @@ + @@ -153,6 +155,7 @@ Rating RD Bound + Games Change @@ -162,6 +165,7 @@ + -- 2.39.2