projects
/
SonOfLokstallBot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0d896b5
)
Make the task list command use the getFilePath function
author
Cameron Ball
<cameron@cameron1729.xyz>
Wed, 19 Dec 2018 05:47:12 +0000
(13:47 +0800)
committer
Cameron Ball
<cameron@cameron1729.xyz>
Fri, 28 Dec 2018 06:27:20 +0000
(14:27 +0800)
purjolok.php
patch
|
blob
|
history
diff --git
a/purjolok.php
b/purjolok.php
index
5cab7de
..
48f360b
100644
(file)
--- a/
purjolok.php
+++ b/
purjolok.php
@@
-138,15
+138,17
@@
getTelegram()->addCommand(
(int)(new DateTimeImmutable('third monday of this month'))->format('d'),
(int)(new DateTimeImmutable('fourth monday of this month'))->format('d'),
];
(int)(new DateTimeImmutable('third monday of this month'))->format('d'),
(int)(new DateTimeImmutable('fourth monday of this month'))->format('d'),
];
- $closestMonday = closest($dt->format('d'), $mondays);
-
+ $currentMonth = (int)(new DateTimeImmutable())->format('m');
+ $currentDayOfMonth = closest((new DateTimeImmutable())->format('d'), $mondays);
+ $currentWeekOfMonth = array_search($currentDayOfMonth, $mondays);
+ $currentYear = (int)(new DateTimeImmutable())->format('Y');
$tasksForTheWeek = getTasksForTheWeek(
$tasksForTheWeek = getTasksForTheWeek(
-
array_search($closestMonday, $mondays)
,
+
$currentWeekOfMonth
,
(int)$dt->format('m'),
require 'taskMatrix.php'
);
(int)$dt->format('m'),
require 'taskMatrix.php'
);
- $completedTasksFile =
"$directory" . "/completed.txt"
;
+ $completedTasksFile =
getFilePathForWeek($currentYear, $currentMonth, $currentWeekOfMonth)
;
$completedTasks = file_exists($completedTasksFile) ? lines(trim(file_get_contents($completedTasksFile))) : [];
$this->replyWithMessage([
$completedTasks = file_exists($completedTasksFile) ? lines(trim(file_get_contents($completedTasksFile))) : [];
$this->replyWithMessage([