Misc cleanup
authorCameron Ball <cameron@cameron1729.xyz>
Sun, 13 Jan 2019 08:25:39 +0000 (16:25 +0800)
committerCameron Ball <cameron@cameron1729.xyz>
Sun, 13 Jan 2019 08:25:39 +0000 (16:25 +0800)
src/common.php

index d884459..d3561ca 100644 (file)
@@ -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;