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', );