From: Cameron Ball Date: Sun, 13 Jan 2019 08:25:39 +0000 (+0800) Subject: Misc cleanup X-Git-Url: http://git.cameron1729.xyz/?p=SonOfLokstallBot.git;a=commitdiff_plain;h=24ba0ed621927ee11c79f746f303339ea599f765 Misc cleanup --- diff --git a/src/common.php b/src/common.php index d884459..d3561ca 100644 --- a/src/common.php +++ b/src/common.php @@ -335,12 +335,10 @@ function getTasksForTheWeek(int $year, int $monthNum, int $weekNum, array $taskM const getFilePathForWeek = 'getFilePathForWeek'; function getFilePathForWeek(int $year, int $monthNum, int $weekNum, string $base) { - // December is part of next year's summer - $seasonYear = $year; return sprintf( '%s/tasks/%s/%s/%s/week%s.txt', $base, - $seasonYear, + $year, getSeason($monthNum), getMonthName($monthNum), $weekNum @@ -423,7 +421,7 @@ function getFilePathsForMonth(int $year, int $monthNum, string $base) { function getFilePathsForSeason(int $year, string $season, string $base) { return array_merge(...map(function($monthNum) use ($year, $base) { // Summer of the current year includes december of the previous year. - $seasonYear = $year - ($monthNum == 12 ? 1 : 0); + $seasonYear = $year - (int)($monthNum == 12); return getFilePathsForMonth($seasonYear, $monthNum, $base); })(array_filter(range(1,12), function($month) use ($season) { return getSeason($month) == $season;