Skip to content

Commit

Permalink
Fix evening ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Dec 24, 2023
1 parent d557b12 commit b7320b1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions templates/Tasks/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
$current = $start;
while ($current < $nextStart) :
$groupedTasks[$current->format('Y-m-d')] = [];
$groupedTasks[$current->format('Y-m-d') . ':evening'] = [];
$current = $current->addDays(1);
endwhile;

Expand All @@ -31,7 +32,7 @@
$key = $task->due_on->format('Y-m-d');
endif;
if ($task->evening) :
$key = "evening:{$key}";
$key = "{$key}:evening";
endif;
$groupedTasks[$key][] = $task;
endforeach;
Expand All @@ -49,8 +50,8 @@
<?php
$dateStr = $key;
$isEvening = false;
if (str_starts_with($dateStr, 'evening:')) {
$dateStr = substr($dateStr, 8);
if (str_contains($dateStr, ':evening')) {
$dateStr = substr($dateStr, 0, strpos($dateStr, ':'));
$isEvening = true;
}
$taskAddUrl = $this->Url->build([
Expand Down

0 comments on commit b7320b1

Please sign in to comment.