summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2008-12-11 19:32:58 -0800
committerArun Persaud <arun@nubati.net>2008-12-11 19:36:04 -0800
commitb4b135a91ee29a31fde39fd6792fe680bf0324d8 (patch)
tree55c6810564307acb25b86f227f5b56288aa42e17
parentb568d14fe83e919b41452d8ae5b57a7dedc671cf (diff)
downloade-DoKo-b4b135a91ee29a31fde39fd6792fe680bf0324d8.tar.gz
e-DoKo-b4b135a91ee29a31fde39fd6792fe680bf0324d8.tar.bz2
e-DoKo-b4b135a91ee29a31fde39fd6792fe680bf0324d8.zip
NEW FEATURE: added a statistic that shows how fast people respond
only uses the difference of timesstamps when you don't play the first card of a trick
-rw-r--r--include/stats.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/stats.php b/include/stats.php
index 83c11ad..dad254c 100644
--- a/include/stats.php
+++ b/include/stats.php
@@ -207,6 +207,21 @@ if( !$content = getCache("cache/stats.html",60*60*24) )
array_unshift($result,array("Name","Number of active games"));
echo output_table($result,"Active games","stats");
+ /* respones by user*/
+ $result = DB_query_array_all("SELECT User.fullname,".
+ "IFNULL(AVG(if(P1.sequence in (2,3,4),".
+ "-timestampdiff(MINUTE,mod_date,(select mod_date from Play P2 where P1.trick_id=P2.trick_id and P2.sequence=P1.sequence-1)),NULL )),1e9) as a, ".
+ " COUNT(*) as na ".
+ "FROM Play P1 ".
+ "LEFT JOIN Hand_Card ON P1.hand_card_id=Hand_Card.id ".
+ "LEFT JOIN Hand ON Hand.id=Hand_Card.hand_id ".
+ "LEFT JOIN User ON Hand.user_id=User.id ".
+ "GROUP BY user_id ".
+ "HAVING na>8 ".
+ "ORDER BY a " );
+ array_unshift($result,array("Name","Average minutes before respond","NR"));
+ echo output_table($result,"Response","stats");
+
/*
does the party win more often if they start