summaryrefslogtreecommitdiffstats
path: root/stats.php
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2007-12-14 12:01:01 +0100
committerArun Persaud <arun@nubati.net>2007-12-14 12:01:01 +0100
commitc7f38cf790f4fa7b5ded66377dc9d79577a93c4e (patch)
tree0e3fa0ba7f268e8eb5862a56e263c07ffda59e84 /stats.php
parent05a61952fc743ea388c10eff29e50adabf4593aa (diff)
downloade-DoKo-c7f38cf790f4fa7b5ded66377dc9d79577a93c4e.tar.gz
e-DoKo-c7f38cf790f4fa7b5ded66377dc9d79577a93c4e.tar.bz2
e-DoKo-c7f38cf790f4fa7b5ded66377dc9d79577a93c4e.zip
NEW FEATURE: display longest session, display shortest games in hours
also name players a bit more often.
Diffstat (limited to 'stats.php')
-rw-r--r--stats.php19
1 files changed, 15 insertions, 4 deletions
diff --git a/stats.php b/stats.php
index f5ce3c0..21b67ed 100644
--- a/stats.php
+++ b/stats.php
@@ -86,7 +86,7 @@ else if( isset($_SESSION["name"]) )
" AND Game.status='gameover'");
while( $r = mysql_fetch_array($result,MYSQL_NUM))
echo $r[0];
- echo " games</p>\n";
+ echo " games.</p>\n";
/* number of solos */
@@ -122,7 +122,7 @@ else if( isset($_SESSION["name"]) )
select id,type,solo,status from game where id in (select id from game where randomnumbers in (select randomnumbers from game where id=27));
*/
- echo "<p>Most extra points (doko, fox, karlchen) in a game::<br />\n";
+ echo "<p>Most extra points (doko, fox, karlchen) in a single game:<br />\n";
$result = mysql_query("SELECT COUNT(*) as c,fullname FROM Score".
" LEFT JOIN User ON User.id=winner_id" .
" WHERE score IN ('fox','doko','karlchen')".
@@ -133,12 +133,13 @@ else if( isset($_SESSION["name"]) )
echo "</p>\n";
/* longest and shortest game */
- $r=mysql_query("SELECT MIN(datediff(mod_date,create_date)),session".
+ $r=mysql_query("SELECT MIN(timediff(mod_date,create_date)),session,id".
" FROM Game WHERE status='gameover' GROUP BY status");
if($r)
{
$short= mysql_fetch_array($r,MYSQL_NUM);
- echo "<p> The shortest game took only ".$short[0]." days.<br />\n";
+ $names = DB_get_all_names_by_gameid($short[2]);
+ echo "<p> The shortest game took only ".$short[0]." hours and was played by ".join(", ",$names).".<br />\n";
}
$r=mysql_query("SELECT MAX(datediff(mod_date,create_date)),session".
@@ -149,6 +150,16 @@ else if( isset($_SESSION["name"]) )
echo "The longest game took ".$long[0]." days.</p>\n";
}
+ $r=mysql_query("SELECT COUNT(*) as c, session, id FROM Game ".
+ " GROUP BY session ORDER BY c DESC LIMIT 1");
+ if($r)
+ {
+ $long = mysql_fetch_array($r,MYSQL_NUM);
+ $names = DB_get_all_names_by_gameid($long[2]);
+ echo "The longest session is session ".$long[1]." with ".$long[0].
+ " games played by ".join(", ",$names).".</p>\n";
+ }
+
/* most reminders */
echo "<p>These players got the most reminders:<br />\n";
$result = mysql_query("SELECT COUNT(*) as c,fullname from Reminder".