Compare commits
1 Commits
1439d33584
...
testdurati
| Author | SHA1 | Date | |
|---|---|---|---|
| 95cc10a8de |
Binary file not shown.
@ -21,7 +21,8 @@ db.exec(`
|
||||
progress INTEGER,
|
||||
type TEXT,
|
||||
parent INTEGER,
|
||||
lazy BOOLEAN DEFAULT 0 -- ✅ Ajout ici
|
||||
assignedTo TEXT,
|
||||
lazy_loading BOOLEAN DEFAULT 0
|
||||
);
|
||||
|
||||
CREATE TABLE links (
|
||||
|
||||
@ -12,8 +12,30 @@ export async function POST({ request }) {
|
||||
const { tasks, links } = await request.json();
|
||||
|
||||
const insertTask = db.prepare(`
|
||||
INSERT INTO tasks (id, text, start, end, duration, progress, type, parent, lazy)
|
||||
VALUES (@id, @text, @start, @end, @duration, @progress, @type, @parent, @lazy)
|
||||
INSERT INTO tasks (
|
||||
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(`
|
||||
@ -21,21 +43,20 @@ export async function POST({ request }) {
|
||||
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 links').run();
|
||||
|
||||
for (const task of all.tasks) {
|
||||
for (const task of tasks) {
|
||||
insertTask.run({
|
||||
...task,
|
||||
start: typeof task.start === 'object' ? new Date(task.start).toISOString() : task.start,
|
||||
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 all.links) {
|
||||
for (const link of links) {
|
||||
insertLink.run(link);
|
||||
}
|
||||
});
|
||||
|
||||
@ -4,40 +4,52 @@
|
||||
|
||||
let tasks = [];
|
||||
let links = [];
|
||||
|
||||
// 🗓️ Affichage : mois + jours
|
||||
const scales = [
|
||||
{ unit: 'month', step: 1, format: 'MMMM yyyy' },
|
||||
{ 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 () => {
|
||||
const res = await fetch('/api/tasks');
|
||||
if (res.ok) {
|
||||
const { tasks: loadedTasks, links: loadedLinks } = await res.json();
|
||||
const res = await fetch('/api/tasks');
|
||||
if (res.ok) {
|
||||
const { tasks: loadedTasks, links: loadedLinks } = await res.json();
|
||||
|
||||
tasks = loadedTasks.map(task => {
|
||||
const start = new Date(task.start);
|
||||
const duration = task.duration || task.estimation || 1;
|
||||
tasks = loadedTasks.map(task => {
|
||||
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),
|
||||
end: end.toISOString().slice(0, 10),
|
||||
duration
|
||||
};
|
||||
});
|
||||
|
||||
links = loadedLinks;
|
||||
} else {
|
||||
console.error('Erreur de chargement des données depuis la base.');
|
||||
}
|
||||
});
|
||||
const end = new Date(start);
|
||||
end.setDate(start.getDate() + duration);
|
||||
|
||||
return {
|
||||
...task,
|
||||
start: start.toISOString().slice(0, 10),
|
||||
end: end.toISOString().slice(0, 10),
|
||||
duration: duration
|
||||
};
|
||||
});
|
||||
|
||||
links = loadedLinks;
|
||||
} else {
|
||||
console.error('Erreur de chargement des données depuis la base.');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<Willow>
|
||||
<Gantt {tasks} {links} {scales} />
|
||||
<Gantt {tasks} {links} {scales} {options} />
|
||||
</Willow>
|
||||
|
||||
@ -25,13 +25,14 @@
|
||||
return {
|
||||
id: index + 1,
|
||||
text: entry['Nom Ticket'],
|
||||
start: start.toISOString().split('T')[0], // ⬅️ Converti en string
|
||||
end: end.toISOString().split('T')[0], // ⬅️ Converti en string
|
||||
start: start.toISOString().split('T')[0],
|
||||
end: end.toISOString().split('T')[0],
|
||||
duration: Number(entry['Estimation (j)']) || 1,
|
||||
progress: Number(entry['RAF']) || 0,
|
||||
type: 'task',
|
||||
parent: null,
|
||||
lazy: false
|
||||
assignedTo: entry['assignedTo'] || '', // ✅ Ajout ici
|
||||
lazy_loading: false // ✅ Correspond à la colonne renommée
|
||||
};
|
||||
});
|
||||
|
||||
@ -53,6 +54,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<h2>Importer un fichier CSV</h2>
|
||||
<input type="file" accept=".csv" on:change={handleFile} />
|
||||
|
||||
|
||||
14
tickets.csv
14
tickets.csv
@ -1,7 +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
|
||||
ID Ticket,Nom Ticket,Estimation (j),Sprint,Statut,RAF,assignedTo
|
||||
T-001,Authentification,5,Sprint 1,Terminé,0,Simon BOYER
|
||||
T-002,Page d’accueil,3,Sprint 1,En cours,2,Simon BOYER
|
||||
T-003,Système de recherche,4,Sprint 2,À faire,4,Fatima BROUM
|
||||
T-005,Sprint 3,3,Sprint 1,En cours,2,Fatima BROUM
|
||||
T-004,Configuration BO,4,Sprint 2,À faire,4,Fatima BROUM
|
||||
T-006,Endpoint à configurer sur api,1,Sprint 2,À faire,1,Fatima BROUM
|
||||
|
Reference in New Issue
Block a user