From c7f38cf790f4fa7b5ded66377dc9d79577a93c4e Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Fri, 14 Dec 2007 12:01:01 +0100 Subject: NEW FEATURE: display longest session, display shortest games in hours also name players a bit more often. --- stats.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'stats.php') 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

\n"; + echo " games.

\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 "

Most extra points (doko, fox, karlchen) in a game::
\n"; + echo "

Most extra points (doko, fox, karlchen) in a single game:
\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 "

\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 "

The shortest game took only ".$short[0]." days.
\n"; + $names = DB_get_all_names_by_gameid($short[2]); + echo "

The shortest game took only ".$short[0]." hours and was played by ".join(", ",$names).".
\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.

\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).".

\n"; + } + /* most reminders */ echo "

These players got the most reminders:
\n"; $result = mysql_query("SELECT COUNT(*) as c,fullname from Reminder". -- cgit v1.2.3-18-g5258