From aa0c41f1ea2879db72bbcf946da696de57784a59 Mon Sep 17 00:00:00 2001 From: Alma Date: Sun, 13 Apr 2025 18:46:31 +0200 Subject: [PATCH] calendar widget 8 --- components/calendar.tsx | 2 +- components/flow.tsx | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/components/calendar.tsx b/components/calendar.tsx index 939fc13b..ce3bf25f 100644 --- a/components/calendar.tsx +++ b/components/calendar.tsx @@ -54,7 +54,7 @@ export function Calendar() { const upcomingEvents = allEvents .filter((event: any) => new Date(event.start) >= now) .sort((a: any, b: any) => new Date(a.start).getTime() - new Date(b.start).getTime()) - .slice(0, 5); + .slice(0, 7); console.log('Calendar Widget - Processed events:', upcomingEvents); setEvents(upcomingEvents); diff --git a/components/flow.tsx b/components/flow.tsx index 02a97b68..8ab2e328 100644 --- a/components/flow.tsx +++ b/components/flow.tsx @@ -22,6 +22,7 @@ interface Task { milestoneHeadline?: string; editTo?: string; editFrom?: string; + type?: string; } interface ProjectSummary { @@ -104,12 +105,13 @@ export function Duties() { return; } - // Filter out completed tasks (status 5) and sort by dateToFinish + // Filter out all tasks and subtasks with status 5 (Done) and sort by dateToFinish const sortedTasks = data .filter((task: Task) => { - const isValid = task.status !== 5; - console.log(`Task ${task.id}: status=${task.status}, dateToFinish=${task.dateToFinish}, isValid=${isValid}`); - return isValid; + const isNotDone = task.status !== 5; + // Log task details for debugging + console.log(`Task ${task.id}: status=${task.status}, type=${task.type || 'main'}, dateToFinish=${task.dateToFinish}, isNotDone=${isNotDone}`); + return isNotDone; }) .sort((a: Task, b: Task) => { // First sort by dateToFinish (oldest first) @@ -137,10 +139,11 @@ export function Duties() { return 0; }); - console.log('Sorted tasks:', sortedTasks.map(t => ({ + console.log('Sorted and filtered tasks:', sortedTasks.map(t => ({ id: t.id, date: t.dateToFinish, - status: t.status + status: t.status, + type: t.type || 'main' }))); setTasks(sortedTasks.slice(0, 7)); } catch (error) {