From 9424a2c6c03d09c0c55b886f066cb895a87cc50c Mon Sep 17 00:00:00 2001 From: BlueRaja Date: Thu, 24 Jan 2013 05:04:00 -0600 Subject: Added (untested) code to try to correctly add points for weekly maps. Let's see what this be like. --- includes/playerStats.php | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'includes/playerStats.php') 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); } /** -- cgit v1.2.3