summaryrefslogtreecommitdiffstats
path: root/stats.php
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2008-03-13 21:37:06 -0700
committerArun Persaud <arun@nubati.net>2008-03-13 21:37:06 -0700
commit2a95396715b96617efcc4f167352581b8ef0d688 (patch)
treeea93addab07686bce835612bdade7ef0f18c1b48 /stats.php
parent3eb71d1ca10d4dc4b06ef84eaa410862ce8d7df9 (diff)
downloade-DoKo-2a95396715b96617efcc4f167352581b8ef0d688.tar.gz
e-DoKo-2a95396715b96617efcc4f167352581b8ef0d688.tar.bz2
e-DoKo-2a95396715b96617efcc4f167352581b8ef0d688.zip
BUGFIX: some stats should really be displayed as an average per game...fixed
The number of foxes caught/lost was displayed in absolut numbers, which didn't look good for people who played a lot of games. So now it's on a per game basis. Signed-off-by: Arun Persaud <arun@nubati.net>
Diffstat (limited to 'stats.php')
-rw-r--r--stats.php27
1 files changed, 19 insertions, 8 deletions
diff --git a/stats.php b/stats.php
index 44378d4..efd2c21 100644
--- a/stats.php
+++ b/stats.php
@@ -155,8 +155,11 @@ else if( isset($_SESSION["name"]) )
}
/* most reminders */
- echo "<p>These players got the most reminders:<br />\n";
- $result = mysql_query("SELECT COUNT(*) as c,fullname from Reminder".
+ echo "<p>These players got the most reminders per game:<br />\n";
+ $result = mysql_query("SELECT COUNT(*) /" .
+ " (SELECT COUNT(*) FROM Hand".
+ " WHERE user_id=User.id) as c,".
+ " fullname FROM Reminder".
" LEFT JOIN User ON User.id=user_id".
" GROUP BY user_id".
" ORDER BY c DESC LIMIT 3" );
@@ -165,22 +168,30 @@ else if( isset($_SESSION["name"]) )
echo "</p>\n";
/* fox */
- echo "<p>These players caught the most foxes:<br />\n";
- $result = mysql_query("SELECT COUNT(*) as c,fullname from Score".
+ echo "<p>These players caught the most foxes per game:<br />\n";
+ $result = mysql_query("SELECT COUNT(*) /" .
+ " (SELECT COUNT(*) FROM Hand".
+ " WHERE user_id=User.id) as c,".
+ " fullname".
+ " FROM Score".
" LEFT JOIN User ON User.id=winner_id".
" WHERE score='fox'".
" GROUP BY winner_id".
- " ORDER BY c DESC LIMIT 2" );
+ " ORDER BY c DESC LIMIT 5" );
while( $r = mysql_fetch_array($result,MYSQL_NUM))
echo $r[1]." (".$r[0].") <br />\n";
echo "</p>\n";
- echo "<p>These players lost their fox most often:<br />\n";
- $result = mysql_query("SELECT COUNT(*) as c,fullname from Score".
+ echo "<p>These players lost their fox most often per game:<br />\n";
+ $result = mysql_query("SELECT COUNT(*) /" .
+ " (SELECT COUNT(*) FROM Hand".
+ " WHERE user_id=User.id) as c,".
+ " fullname".
+ " FROM Score".
" LEFT JOIN User ON User.id=looser_id".
" WHERE score='fox'".
" GROUP BY looser_id".
- " ORDER BY c DESC LIMIT 2" );
+ " ORDER BY c DESC LIMIT 5" );
while( $r = mysql_fetch_array($result,MYSQL_NUM))
echo $r[1]." (".$r[0].") <br />\n";
echo "</p>\n";