summaryrefslogtreecommitdiffstats
path: root/include/stats.php
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2008-06-01 19:34:10 -0700
committerArun Persaud <arun@nubati.net>2008-06-01 19:34:10 -0700
commitbf9a638ffd9b65d18b682e8b3e9bf19f798181cb (patch)
tree669c06bfd9360b47afbb88e767e710257a45a8af /include/stats.php
parent077ab356084fa26910200f28a9cd44a954f291eb (diff)
downloade-DoKo-bf9a638ffd9b65d18b682e8b3e9bf19f798181cb.tar.gz
e-DoKo-bf9a638ffd9b65d18b682e8b3e9bf19f798181cb.tar.bz2
e-DoKo-bf9a638ffd9b65d18b682e8b3e9bf19f798181cb.zip
NEW FEATURE: statistics of most solos per game
added a new statistic Signed-off-by: Arun Persaud <arun@nubati.net>
Diffstat (limited to 'include/stats.php')
-rw-r--r--include/stats.php14
1 files changed, 14 insertions, 0 deletions
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".