summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2007-12-14 15:33:49 +0100
committerArun Persaud <arun@nubati.net>2007-12-14 15:51:56 +0100
commit672791e22e1de68e278e2f0d5c6d7331d5994ecb (patch)
tree19c042ece43b297f38d7d3e5c7f213510a302d4c
parent3db5eb27624bf78817a69da847af22f3986f20fe (diff)
downloade-DoKo-672791e22e1de68e278e2f0d5c6d7331d5994ecb.tar.gz
e-DoKo-672791e22e1de68e278e2f0d5c6d7331d5994ecb.tar.bz2
e-DoKo-672791e22e1de68e278e2f0d5c6d7331d5994ecb.zip
BUGFIX: wrong SQL query for min and max time of games
the wrong time was shown for the minimum game
-rw-r--r--stats.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/stats.php b/stats.php
index 5bbca26..ba32a92 100644
--- a/stats.php
+++ b/stats.php
@@ -134,8 +134,10 @@ else if( isset($_SESSION["name"]) )
echo "</p>\n";
/* longest and shortest game */
- $r=mysql_query("SELECT MIN(timediff(mod_date,create_date)),session,id".
- " FROM Game WHERE status='gameover' GROUP BY status");
+ $r=mysql_query("SELECT timediff(mod_date,create_date) ,session,id".
+ " FROM Game WHERE status='gameover'".
+ " ORDER BY time_to_sec(timediff(mod_date,create_date)) ASC LIMIT 1");
+
if($r)
{
$short= mysql_fetch_array($r,MYSQL_NUM);
@@ -143,8 +145,9 @@ else if( isset($_SESSION["name"]) )
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".
- " FROM Game where status='gameover' GROUP BY status");
+ $r=mysql_query("SELECT datediff(mod_date,create_date) ,session,id".
+ " FROM Game WHERE status='gameover'".
+ " ORDER BY time_to_sec(timediff(mod_date,create_date)) DESC LIMIT 1");
if($r)
{
$long= mysql_fetch_array($r,MYSQL_NUM);