From ce5fd5621e0162b084b0d5abc5ead3f45811320a Mon Sep 17 00:00:00 2001 From: Bastien COIGNOUX Date: Mon, 14 Jul 2025 15:59:04 +0200 Subject: [PATCH] loading duration --- svar-gantt-app/data.db | Bin 16384 -> 16384 bytes svar-gantt-app/src/routes/gantt/+page.svelte | 34 ++++++++++++++----- tickets.csv | 7 ++++ 3 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 tickets.csv diff --git a/svar-gantt-app/data.db b/svar-gantt-app/data.db index 0d088210dac67a75108c63086df5c0b1dcccd518..a0884b33dcf6d690f5820c7ac6d0b2b4c3342e6a 100644 GIT binary patch delta 190 zcmZo@U~Fh$oFL7}GEv5vk!54T5`FKn;01wnd%yt>l&I)4v{zDHiq*}Cily0a~r|=#*>c%`G#=5(dOUsECP(Iiwpz+ D?{^<~ diff --git a/svar-gantt-app/src/routes/gantt/+page.svelte b/svar-gantt-app/src/routes/gantt/+page.svelte index f37619b..2b83ff8 100644 --- a/svar-gantt-app/src/routes/gantt/+page.svelte +++ b/svar-gantt-app/src/routes/gantt/+page.svelte @@ -10,15 +10,31 @@ ]; onMount(async () => { - const res = await fetch('/api/tasks'); - if (res.ok) { - const { tasks: loadedTasks, links: loadedLinks } = await res.json(); - tasks = loadedTasks; - links = loadedLinks; - } else { - console.error('Erreur de chargement des données depuis la base.'); - } - }); + const res = await fetch('/api/tasks'); + if (res.ok) { + const { tasks: loadedTasks, links: loadedLinks } = await res.json(); + + tasks = loadedTasks.map(task => { + // Assure que start est une date ISO + const start = new Date(task.start); + const duration = task.duration || task.estimation || 1; + + const end = new Date(start); + end.setDate(start.getDate() + duration); + + return { + ...task, + start: start.toISOString().slice(0, 10), // "YYYY-MM-DD" + end: end.toISOString().slice(0, 10) + }; + }); + + links = loadedLinks; + } else { + console.error('Erreur de chargement des données depuis la base.'); + } +}); + diff --git a/tickets.csv b/tickets.csv new file mode 100644 index 0000000..a03b822 --- /dev/null +++ b/tickets.csv @@ -0,0 +1,7 @@ +ID Ticket,Nom Ticket,Estimation (j),Sprint,Statut,RAF +T-001,Authentification,5,Sprint 1,Terminé,0 +T-002,Page d’accueil,3,Sprint 1,En cours,2 +T-003,Système de recherche,4,Sprint 2,À faire,4 +T-005,Sprint 3,3,Sprint 1,En cours,2 +T-004,Configuration BO,4,Sprint 2,À faire,4 +T-006,Endpoint à configurer sur api,1,Sprint 2,À faire,1 \ No newline at end of file