diff options
Diffstat (limited to 'includes/playerStats.php')
-rw-r--r-- | includes/playerStats.php | 28 |
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); } /** |