summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--css/stats.css10
-rw-r--r--includes/championPoints.php7
-rw-r--r--pages/leaderboard.php15
3 files changed, 26 insertions, 6 deletions
diff --git a/css/stats.css b/css/stats.css
index ab4cb96..23a6003 100644
--- a/css/stats.css
+++ b/css/stats.css
@@ -112,3 +112,13 @@ td, th {
white-space:nowrap;
}
+.wrapper .col1 #myPoints
+{
+ text-align: center;
+ color: #00DDFF;
+}
+
+.wrapper .col1 #myPoints #myPointsValue
+{
+ font-weight: bold;
+} \ No newline at end of file
diff --git a/includes/championPoints.php b/includes/championPoints.php
index e824c0c..b99fde3 100644
--- a/includes/championPoints.php
+++ b/includes/championPoints.php
@@ -107,9 +107,9 @@ function addPlayerChampionPointsForMapsOfTheDay($fromDate)
$sql3 = "
-- Add the points for doing the weekly maps
UPDATE solutions
- SET championPointsWorth =
+ SET championPointsWorth = championPointsWorth +
(
- SELECT SUM(".CP_MAX_WORTH_WEEKLY." *
+ SELECT IFNULL(SUM(".CP_MAX_WORTH_WEEKLY." *
(
SELECT COUNT(*)
FROM (SELECT * FROM solutions) AS s2
@@ -119,11 +119,12 @@ function addPlayerChampionPointsForMapsOfTheDay($fromDate)
SELECT GREATEST(COUNT(*)-1, 1)
FROM (SELECT * FROM solutions) AS s2
WHERE s2.mapID = mapOfTheDay.mapID
- ) + ".CP_MIN_WORTH_WEEKLY.")
+ ) + ".CP_MIN_WORTH_WEEKLY."), 0)
FROM mapOfTheDay
INNER JOIN (SELECT * FROM solutions) AS usersSolutions ON usersSolutions.mapID = mapOfTheDay.mapID
WHERE usersSolutions.ID = solutions.ID
AND mapOfTheDay.mapType = 5
+ AND mapOfTheDay.mapDate >= '$fromDate'
);
";
diff --git a/pages/leaderboard.php b/pages/leaderboard.php
index 292de60..a256f1c 100644
--- a/pages/leaderboard.php
+++ b/pages/leaderboard.php
@@ -109,7 +109,8 @@ function getStat ($type, $daysAgo = 1) {
userData.wallColor,
userData.wallEmblem,
userData.displayColor,
- users.ID as userID
+ users.ID as userID,
+ solutions.championPointsWorth
FROM `maps`
JOIN `solutions`
ON maps.ID = solutions.mapID
@@ -198,7 +199,8 @@ function displayPastMaze($mapType, $name, $daysAgo = 1) {
userData.wallColor,
userData.wallEmblem,
userData.displayColor,
- users.ID as userID
+ users.ID as userID,
+ solutions.championPointsWorth
FROM `maps`
JOIN `solutions`
ON maps.ID = solutions.mapID
@@ -269,6 +271,7 @@ function displaystats($result, $caption = NULL) {
//$r .= "</tr>";
$i = 1;
+ $championPoints = null;
while ($row = mysql_fetch_assoc($result)) {
$rowcontent = '';
$mapid = $row['mapID'];
@@ -293,6 +296,7 @@ function displaystats($result, $caption = NULL) {
if ($userID == $_SESSION['userID']) {
$promotedContent .= $x;
+ $championPoints = $row['championPointsWorth'];
} else {
$content .= $x;
}
@@ -300,7 +304,12 @@ function displaystats($result, $caption = NULL) {
$i++;
}
- $r = "<table style='border:1px solid #FFF'>";
+ $r = '';
+ if($championPoints != null)
+ {
+ $r .= "<div id='myPoints'>Points earned: <span id='myPointsValue'>$championPoints</span></div>";
+ }
+ $r .= "<table style='border:1px solid #FFF'>";
$r .= "<caption>$caption</caption>";
$r .= $headers;
$r .= $promotedContent;