Fix todo due date also counting completed items
This commit is contained in:
1 parent
8ff955415c
commit
4ee1d01e38
4 files changed
+21
-7
No files matched your search
@@ -39,7 +39,12 @@ public function index()
|
||||
|
||||
// Process items to add latest_todo_due_date and remove todos array
|
||||
$laneArray['items'] = collect($laneArray['items'])->map(function ($item) {
|
||||
$item['next_todo_due_date'] = $item['todos'][0]['due_date'] ?? null;
|
||||
// Find the first todo with status != 'COMPLETED'
|
||||
$nextTodo = collect($item['todos'])->first(function ($todo) {
|
||||
return strtolower($todo['status'] ?? '') !== 'completed';
|
||||
});
|
||||
|
||||
$item['next_todo_due_date'] = $nextTodo['due_date'] ?? null;
|
||||
unset($item['todos']); // Remove the todos array
|
||||
return $item;
|
||||
})->toArray();
|
||||
|
||||
Reference in new issue
Block a user