From d42b3035992c17c7b0b456e5c43aee06a157f636 Mon Sep 17 00:00:00 2001 From: Cameron Ball Date: Sun, 6 Jan 2019 03:58:30 +0800 Subject: [PATCH] Fix bug where tasks weren't detected as all done after completing the last one --- src/purjolok.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/purjolok.php b/src/purjolok.php index ab224a3..9f4cacd 100644 --- a/src/purjolok.php +++ b/src/purjolok.php @@ -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') -- 2.11.0