NEW FEATURE: statistics of most solos per game
authorArun Persaud <arun@nubati.net>
Mon, 2 Jun 2008 02:34:10 +0000 (19:34 -0700)
committerArun Persaud <arun@nubati.net>
Mon, 2 Jun 2008 02:34:10 +0000 (19:34 -0700)
added a new statistic

Signed-off-by: Arun Persaud <arun@nubati.net>
include/stats.php

index ba2ea6d2cde87bbebf77cc9d7915a6cceff9bd43..c7b0da16c8eb4285469eeceffed21a9383c21299 100644 (file)
@@ -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".