Fix bug where tasks weren't detected as all done after completing the last one
[SonOfLokstallBot.git] / src / purjolok.php
index ab224a3..9f4cacd 100644 (file)
@@ -75,7 +75,7 @@ if ($between = between(reveal($message ?? ''), '[taskid]')) {
         'sticker' => 'CAADBQADOwAD__7RB2i3XcCiO8HuAg'
     ]);
 
-    if (!array_diff($tasksForTheWeek, $completedTasks)) {
+    if (!array_diff($tasksForTheWeek, array_merge($completedTasks, [$between]))) {
         getTelegram()->sendMessage([
             'chat_id' => $chatid,
             'text' => getString('heyTasksAllCompleted')
@@ -300,8 +300,6 @@ getTelegram()->addCommand(
             $completedTasksFile = getFilePathForWeek($yearForThisWeek, $monthForThisWeek, $weekNum);
             $completedTasks = file_exists($completedTasksFile) ? lines(trim(file_get_contents($completedTasksFile))) : [];
 
-
-
             if (!array_diff($tasksForTheWeek, $completedTasks)) {
                 $this->replyWithMessage([
                     'text' => getString('tasksAllCompleted')