feat(timeline): fixed task timeblocks timeline to display draft timeblocks

This commit is contained in:
Matej Glasnák committed 2026-01-19 16:13:01 +01:00
1 parent 0c407cb903
commit ec4175230a
1 file changed
+16 -2
@@ -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',
);