summaryrefslogtreecommitdiffstats
path: root/pages/memberlist.php
diff options
context:
space:
mode:
authorPatrick Davison <snapwilliam@gmail.com>2012-07-17 13:07:50 -0700
committerPatrick Davison <snapwilliam@gmail.com>2012-07-17 13:07:50 -0700
commit06401cf3806da7ef552507ad75d5c1996850cb97 (patch)
tree99993340a2f6a5e8dd4ca97daa8914191fed4fe4 /pages/memberlist.php
parent85a7a6fb108357853ea1d5b9cc5e598f493eb165 (diff)
downloadpathery-06401cf3806da7ef552507ad75d5c1996850cb97.tar.xz
Added field: Total Moves This Week to members page.
Diffstat (limited to 'pages/memberlist.php')
-rw-r--r--pages/memberlist.php17
1 files changed, 15 insertions, 2 deletions
diff --git a/pages/memberlist.php b/pages/memberlist.php
index 8a65a03..d4f2c60 100644
--- a/pages/memberlist.php
+++ b/pages/memberlist.php
@@ -11,11 +11,14 @@ topbar($Links);
include_once ('./includes/db.inc.php');
//Order by prep
-$c = 'totalMoves';
+$c = 'totalMovesThisWeek';
switch ($_GET['c']) {
case "totalMoves":
$c = 'totalMoves';
break;
+ case "totalMovesThisWeek":
+ $c = 'totalMovesThisWeek';
+ break;
case "totalMazes":
$c = 'totalMazes';
break;
@@ -49,6 +52,9 @@ $sql = "SELECT
users.displayName,
userData.displayColor,
(SELECT SUM(moves) FROM solutions WHERE solutions.userID = users.ID) AS totalMoves,
+ (SELECT SUM(moves) FROM solutions
+ WHERE solutions.userID = users.ID AND
+ YEARweek(solutions.dateModified) = YEARweek(CURRENT_DATE)) AS totalMovesThisWeek,
(SELECT COUNT(*) FROM solutions WHERE solutions.userID = users.ID) AS totalMazes,
SUM(CASE WHEN statistics.type IN (32, 33, 34, 35) THEN statistics.value ELSE 0 END) as totalWins,
SUM(CASE WHEN statistics.type IN (1, 2, 3, 4) THEN statistics.value ELSE 0 END) as totalTies,
@@ -77,6 +83,9 @@ $cat['Mazes']['title'] = 'Total Mazes Played';
$cat['Moves']['c'] = 'totalMoves';
$cat['Moves']['title'] = 'Total Moves Mazed';
+$cat['This Week']['c'] = 'totalMovesThisWeek';
+$cat['This Week']['title'] = 'Total Moves Mazed This Week (Starting Monday)';
+
$cat['Wins']['c'] = 'totalWins';
$cat['Wins']['title'] = 'Total Wins (Champion)';
@@ -114,7 +123,7 @@ foreach ($cat as $name => $item) {
//Echo Table Data
$i = 0;
-while (list($userID, $display, $displayColor, $moveCount, $mazeCount, $winCount, $tieCount, $wallColor, $nameColor, $wallEmblem, $joined, $lastLogon) = mysql_fetch_row($result)) {
+while (list($userID, $display, $displayColor, $moveCount, $moveCountWeek, $mazeCount, $winCount, $tieCount, $wallColor, $nameColor, $wallEmblem, $joined, $lastLogon) = mysql_fetch_row($result)) {
//Prepare data
$i++;
@@ -123,6 +132,9 @@ while (list($userID, $display, $displayColor, $moveCount, $mazeCount, $winCount,
if (!$moveCount)
$moveCount = 0;
+ if (!$moveCountWeek)
+ $moveCountWeek = 0;
+
if ($lastLogon == 0)
$lastLogon = "Never";
@@ -146,6 +158,7 @@ while (list($userID, $display, $displayColor, $moveCount, $mazeCount, $winCount,
<td>$mazeCount</td>
<td>$moveCount</td>
+ <td>$moveCountWeek</td>
<td>$winCount</td>
<td>$tieCount</td>