Implementierung Wissensmanagement

Dieser Commit ist enthalten in:
HG
2025-12-30 22:49:56 +00:00
committet von Server Deploy
Ursprung 9bf298c26b
Commit 395598c2b0
51 geänderte Dateien mit 7598 neuen und 32 gelöschten Zeilen

Datei anzeigen

@ -1321,7 +1321,8 @@ class TaskModalManager {
try {
const projectId = store.get('currentProjectId');
const subtask = await api.createSubtask(projectId, this.taskId, { title });
this.subtasks.push(subtask);
// Neue Subtask an erster Stelle einfügen
this.subtasks.unshift(subtask);
this.renderSubtasks();
input.value = '';
@ -1331,8 +1332,8 @@ class TaskModalManager {
this.showError('Fehler beim Hinzufügen');
}
} else {
// For new tasks, store locally
this.subtasks.push({
// For new tasks, store locally - an erster Stelle
this.subtasks.unshift({
id: generateTempId(),
title,
completed: false
@ -1346,6 +1347,7 @@ class TaskModalManager {
const subtask = this.subtasks.find(s => s.id === subtaskId);
if (!subtask) return;
const wasCompleted = subtask.completed;
subtask.completed = !subtask.completed;
if (this.mode === 'edit' && this.taskId) {
@ -1355,10 +1357,26 @@ class TaskModalManager {
completed: subtask.completed
});
// Wenn abgehakt: ans Ende der Liste verschieben
if (subtask.completed && !wasCompleted) {
const currentIndex = this.subtasks.findIndex(s => s.id === subtaskId);
const lastPosition = this.subtasks.length - 1;
if (currentIndex < lastPosition) {
// Aus aktueller Position entfernen
const [moved] = this.subtasks.splice(currentIndex, 1);
// Ans Ende anfügen
this.subtasks.push(moved);
// API-Call für neue Position
await api.reorderSubtasks(projectId, this.taskId, subtaskId, lastPosition);
}
}
// Update subtask progress in store for immediate board update
this.updateSubtaskProgressInStore();
} catch (error) {
subtask.completed = !subtask.completed;
subtask.completed = wasCompleted;
this.showError('Fehler beim Aktualisieren');
}
}