summaryrefslogtreecommitdiffstats
path: root/includes/playerStats.php
diff options
context:
space:
mode:
authorBlueRaja <BlueRaja.admin@gmail.com>2013-01-24 05:04:00 -0600
committerBlueRaja <BlueRaja.admin@gmail.com>2013-01-24 05:04:00 -0600
commit9424a2c6c03d09c0c55b886f066cb895a87cc50c (patch)
treef6459d395fa25bf13943317e1f0234f072976c59 /includes/playerStats.php
parentfc01ef69fa058d4922ec34ac636ae15e5a6bcece (diff)
downloadpathery-9424a2c6c03d09c0c55b886f066cb895a87cc50c.tar.xz
Added (untested) code to try to correctly add points for weekly maps. Let's see what this be like.
Diffstat (limited to 'includes/playerStats.php')
-rw-r--r--includes/playerStats.php28
1 files changed, 23 insertions, 5 deletions
diff --git a/includes/playerStats.php b/includes/playerStats.php
index 6cf42fe..c429f14 100644
--- a/includes/playerStats.php
+++ b/includes/playerStats.php
@@ -236,11 +236,29 @@ function addOtherStats($mapExpireTime)
*/
function addStatsForYesterdaysMaps()
{
- $todayStr = date('Y-m-d', time());
- setHighScoreFlags($todayStr);
- calculateMapsChampionPointWorth($todayStr);
- addPlayerChampionPointsForMapsOfTheDay($todayStr);
- addOtherStats($todayStr);
+ $today = time();
+ addStatsForDateTimeInternal($today);
+}
+
+/**
+ * Adds stats for maps that end mid-day (namely, weekly maps)
+ */
+function addStatsForMiddayMaps()
+{
+ $noonToday = strtotime('noon', time());
+ addStatsForDateTimeInternal($noonToday);
+}
+
+/**
+ * Adds stats for maps that expire after the given date-time. Should not be called outside of playerStats.php
+ */
+function addStatsForDateTimeInternal($dateTime)
+{
+ $dateTimeStr = date('Y-m-d H:i:s', $dateTime);
+ setHighScoreFlags($dateTimeStr);
+ calculateMapsChampionPointWorth($dateTimeStr);
+ addPlayerChampionPointsForMapsOfTheDay($dateTimeStr);
+ addOtherStats($dateTimeStr);
}
/**