assign_dont_work

This commit is contained in:
Bastien COIGNOUX
2025-07-14 19:10:55 +02:00
parent 1439d33584
commit 95cc10a8de
6 changed files with 77 additions and 41 deletions

Binary file not shown.

View File

@ -21,7 +21,8 @@ db.exec(`
progress INTEGER, progress INTEGER,
type TEXT, type TEXT,
parent INTEGER, parent INTEGER,
lazy BOOLEAN DEFAULT 0 -- ✅ Ajout ici assignedTo TEXT,
lazy_loading BOOLEAN DEFAULT 0
); );
CREATE TABLE links ( CREATE TABLE links (

View File

@ -12,8 +12,30 @@ export async function POST({ request }) {
const { tasks, links } = await request.json(); const { tasks, links } = await request.json();
const insertTask = db.prepare(` const insertTask = db.prepare(`
INSERT INTO tasks (id, text, start, end, duration, progress, type, parent, lazy) INSERT INTO tasks (
VALUES (@id, @text, @start, @end, @duration, @progress, @type, @parent, @lazy) id,
text,
start,
end,
duration,
progress,
type,
parent,
assignedTo,
lazy_loading
)
VALUES (
@id,
@text,
@start,
@end,
@duration,
@progress,
@type,
@parent,
@assignedTo,
@lazy_loading
)
`); `);
const insertLink = db.prepare(` const insertLink = db.prepare(`
@ -21,21 +43,20 @@ export async function POST({ request }) {
VALUES (@id, @source, @target, @type) VALUES (@id, @source, @target, @type)
`); `);
const taskTx = db.transaction((all) => { const taskTx = db.transaction(({ tasks, links }) => {
db.prepare('DELETE FROM tasks').run(); db.prepare('DELETE FROM tasks').run();
db.prepare('DELETE FROM links').run(); db.prepare('DELETE FROM links').run();
for (const task of all.tasks) { for (const task of tasks) {
insertTask.run({ insertTask.run({
...task, ...task,
start: typeof task.start === 'object' ? new Date(task.start).toISOString() : task.start, start: typeof task.start === 'object' ? new Date(task.start).toISOString() : task.start,
end: typeof task.end === 'object' ? new Date(task.end).toISOString() : task.end, end: typeof task.end === 'object' ? new Date(task.end).toISOString() : task.end,
lazy: task.lazy ? 1 : 0, // ⚠️ SQLite ne supporte pas le type boolean natif lazy_loading: task.lazy_loading ? 1 : 0
}); });
} }
for (const link of links) {
for (const link of all.links) {
insertLink.run(link); insertLink.run(link);
} }
}); });

View File

@ -4,11 +4,25 @@
let tasks = []; let tasks = [];
let links = []; let links = [];
// 🗓️ Affichage : mois + jours
const scales = [ const scales = [
{ unit: 'month', step: 1, format: 'MMMM yyyy' }, { unit: 'month', step: 1, format: 'MMMM yyyy' },
{ unit: 'day', step: 1, format: 'd' } { unit: 'day', step: 1, format: 'd' }
]; ];
// 📋 Options : colonnes personnalisées
const options = {
taskList: {
visible: true, // ✅ Important
columns: [
{ id: 'text', label: 'Nom', value: 'text', width: 200 },
{ id: 'assignedTo', label: 'Assignée à', value: 'assignedTo', width: 150 }
]
}
};
onMount(async () => { onMount(async () => {
const res = await fetch('/api/tasks'); const res = await fetch('/api/tasks');
if (res.ok) { if (res.ok) {
@ -25,7 +39,7 @@
...task, ...task,
start: start.toISOString().slice(0, 10), start: start.toISOString().slice(0, 10),
end: end.toISOString().slice(0, 10), end: end.toISOString().slice(0, 10),
duration duration: duration
}; };
}); });
@ -33,11 +47,9 @@
} else { } else {
console.error('Erreur de chargement des données depuis la base.'); console.error('Erreur de chargement des données depuis la base.');
} }
}); });
</script> </script>
<Willow> <Willow>
<Gantt {tasks} {links} {scales} /> <Gantt {tasks} {links} {scales} {options} />
</Willow> </Willow>

View File

@ -25,13 +25,14 @@
return { return {
id: index + 1, id: index + 1,
text: entry['Nom Ticket'], text: entry['Nom Ticket'],
start: start.toISOString().split('T')[0], // ⬅️ Converti en string start: start.toISOString().split('T')[0],
end: end.toISOString().split('T')[0], // ⬅️ Converti en string end: end.toISOString().split('T')[0],
duration: Number(entry['Estimation (j)']) || 1, duration: Number(entry['Estimation (j)']) || 1,
progress: Number(entry['RAF']) || 0, progress: Number(entry['RAF']) || 0,
type: 'task', type: 'task',
parent: null, parent: null,
lazy: false assignedTo: entry['assignedTo'] || '', // ✅ Ajout ici
lazy_loading: false // ✅ Correspond à la colonne renommée
}; };
}); });
@ -53,6 +54,7 @@
} }
</script> </script>
<h2>Importer un fichier CSV</h2> <h2>Importer un fichier CSV</h2>
<input type="file" accept=".csv" on:change={handleFile} /> <input type="file" accept=".csv" on:change={handleFile} />

View File

@ -1,7 +1,7 @@
ID Ticket,Nom Ticket,Estimation (j),Sprint,Statut,RAF ID Ticket,Nom Ticket,Estimation (j),Sprint,Statut,RAF,assignedTo
T-001,Authentification,5,Sprint 1,Terminé,0 T-001,Authentification,5,Sprint 1,Terminé,0,Simon BOYER
T-002,Page daccueil,3,Sprint 1,En cours,2 T-002,Page daccueil,3,Sprint 1,En cours,2,Simon BOYER
T-003,Système de recherche,4,Sprint 2,À faire,4 T-003,Système de recherche,4,Sprint 2,À faire,4,Fatima BROUM
T-005,Sprint 3,3,Sprint 1,En cours,2 T-005,Sprint 3,3,Sprint 1,En cours,2,Fatima BROUM
T-004,Configuration BO,4,Sprint 2,À faire,4 T-004,Configuration BO,4,Sprint 2,À faire,4,Fatima BROUM
T-006,Endpoint à configurer sur api,1,Sprint 2,À faire,1 T-006,Endpoint à configurer sur api,1,Sprint 2,À faire,1,Fatima BROUM
1 ID Ticket Nom Ticket Estimation (j) Sprint Statut RAF assignedTo
2 T-001 Authentification 5 Sprint 1 Terminé 0 Simon BOYER
3 T-002 Page d’accueil 3 Sprint 1 En cours 2 Simon BOYER
4 T-003 Système de recherche 4 Sprint 2 À faire 4 Fatima BROUM
5 T-005 Sprint 3 3 Sprint 1 En cours 2 Fatima BROUM
6 T-004 Configuration BO 4 Sprint 2 À faire 4 Fatima BROUM
7 T-006 Endpoint à configurer sur api 1 Sprint 2 À faire 1 Fatima BROUM