From ec4175230ac71f3b39ec046083c3c096f6385ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Glasn=C3=A1k?= Date: Mon, 19 Jan 2026 16:13:01 +0100 Subject: [PATCH] feat(timeline): fixed task timeblocks timeline to display draft timeblocks --- .../plugins/tm@_utils/useEmployeeTimeline.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/app/src/plugins/tm@_utils/useEmployeeTimeline.ts b/app/src/plugins/tm@_utils/useEmployeeTimeline.ts index 5c796b4..b8e6faf 100644 --- a/app/src/plugins/tm@_utils/useEmployeeTimeline.ts +++ b/app/src/plugins/tm@_utils/useEmployeeTimeline.ts @@ -170,8 +170,22 @@ export function useEmployeeTimeline( tasks.push(task); } } else { - // Process regular subtasks with timeblocks array - subtask.timeblocks?.forEach((timeblock: any) => { + // Determine the correct timeblocks array based on task type + let timeblocks: any[] | undefined; + + // For draft tasks with employees array, get timeblocks from the matching employee + if (subtask.is_draft && Array.isArray(subtask.employees)) { + const employeeData = subtask.employees.find( + (empData: any) => Number(empData.id) === Number(emp.id), + ); + timeblocks = employeeData?.timeblocks; + } else { + // For regular tasks, use root-level timeblocks array + timeblocks = subtask.timeblocks; + } + + // Process timeblocks (same logic for both regular and concept tasks) + timeblocks?.forEach((timeblock: any) => { const timeblockDateStr = moment(timeblock.start).format( 'YYYY-MM-DD', );