Implement reminders for house maintenance
[SonOfLokstallBot.git] / unfinished.php
1 <?php
2
3 require_once('common.php');
4
5 $dt = new DateTimeImmutable();
6
7 $mondays = [
8 (int)(new DateTimeImmutable('first monday of this month'))->format('d'),
9 (int)(new DateTimeImmutable('second monday of this month'))->format('d'),
10 (int)(new DateTimeImmutable('third monday of this month'))->format('d'),
11 (int)(new DateTimeImmutable('fourth monday of this month'))->format('d'),
12 ];
13
14 $directory = sprintf(
15 "tasks/%s/%s/%s",
16 $dt->format('Y'),
17 $dt->format('F'),
18 $dt->format('W')
19 );
20 $completedTasksFile = "$directory" . "/completed.txt";
21 $completedTasks = file_exists($completedTasksFile) ? lines(trim(file_get_contents($completedTasksFile))) : [];
22
23 $closestMonday = closest($dt->format('d'), $mondays);
24
25 $tasksForTheWeek = getTasksForTheWeek(
26 array_search($closestMonday, $mondays),
27 $dt->format('m'),
28 require 'taskMatrix.php'
29 );
30
31 $unfinished = array_diff($tasksForTheWeek, $completedTasks);
32
33 print_r(
34 array_diff(['treeflowers', 'someothershit'], ['treeflowers'])
35 );