From 966dc18faf53d3c538022087dc41e1ad28d90bc8 Mon Sep 17 00:00:00 2001 From: Alma Date: Sun, 13 Apr 2025 18:48:05 +0200 Subject: [PATCH] duties widget correction --- app/api/leantime/tasks/route.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/api/leantime/tasks/route.ts b/app/api/leantime/tasks/route.ts index 882aaa6c..75fecaf2 100644 --- a/app/api/leantime/tasks/route.ts +++ b/app/api/leantime/tasks/route.ts @@ -152,8 +152,9 @@ export async function GET(request: NextRequest) { const tasks = data.result .filter((task: any) => { - // Skip completed tasks (status 5) + // Skip all completed tasks (status 5), whether they are main tasks or subtasks if (task.status === 5) { + console.log(`Filtering out completed task ${task.id} (type: ${task.type || 'main'})`); return false; } @@ -162,7 +163,9 @@ export async function GET(request: NextRequest) { const currentUserId = String(userId).trim(); // Only show tasks where the user is the editor - return taskEditorId === currentUserId; + const isUserEditor = taskEditorId === currentUserId; + console.log(`Task ${task.id}: status=${task.status}, type=${task.type || 'main'}, isUserEditor=${isUserEditor}`); + return isUserEditor; }) .map((task: any) => ({ id: task.id.toString(), @@ -177,7 +180,8 @@ export async function GET(request: NextRequest) { editedOn: task.editedOn || null, editorId: task.editorId, editorFirstname: task.editorFirstname, - editorLastname: task.editorLastname + editorLastname: task.editorLastname, + type: task.type || null // Added type field to identify subtasks })); console.log(`Found ${tasks.length} tasks assigned to user ${userId}`);