From bf9a638ffd9b65d18b682e8b3e9bf19f798181cb Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Sun, 1 Jun 2008 19:34:10 -0700 Subject: [PATCH] NEW FEATURE: statistics of most solos per game added a new statistic Signed-off-by: Arun Persaud --- include/stats.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/stats.php b/include/stats.php index ba2ea6d..c7b0da1 100644 --- a/include/stats.php +++ b/include/stats.php @@ -177,6 +177,20 @@ $result = DB_query_array_all("SELECT fullname, COUNT(*) as c " . array_unshift($result,array("Name","Number of games")); echo output_table($result,"Most games","stats"); +/* most solos */ +$result = DB_query_array_all("SELECT fullname as fname,". + " COUNT(*), ". + " COUNT(*)/(SELECT COUNT(*) FROM Hand LEFT JOIN User ON User.id=Hand.user_id WHERE fullname=fname) as c ". + " FROM Game ". + " LEFT JOIN Hand ON Hand.position=startplayer AND Game.id=Hand.game_id ". + " LEFT JOIN User ON User.id=Hand.user_id ". + " WHERE type='solo' AND Game.solo<>'silent' AND Game.status='gameover' ". + " GROUP BY user_id ". + " ORDER BY c DESC;"); +array_unshift($result,array("Name","Number of solos","Solos/game")); +echo output_table($result,"Most solos","stats"); + + /* most active games */ $result = DB_query_array_all("SELECT fullname, COUNT(*) as c " . " FROM Hand". -- 2.25.1