fix(JiraService): preserve archived status when updating tasks
This commit is contained in:
@@ -539,6 +539,9 @@ export class JiraService {
|
|||||||
existingTask.priority !== taskData.priority
|
existingTask.priority !== taskData.priority
|
||||||
? existingTask.priority
|
? existingTask.priority
|
||||||
: taskData.priority;
|
: taskData.priority;
|
||||||
|
// Préserver le statut archived local - ne jamais désarchiver depuis Jira
|
||||||
|
const finalStatus =
|
||||||
|
existingTask.status === 'archived' ? 'archived' : taskData.status;
|
||||||
|
|
||||||
if (existingTask.title !== taskData.title) {
|
if (existingTask.title !== taskData.title) {
|
||||||
changes.push(`Titre: préservé localement ("${existingTask.title}")`);
|
changes.push(`Titre: préservé localement ("${existingTask.title}")`);
|
||||||
@@ -546,8 +549,13 @@ export class JiraService {
|
|||||||
if (existingTask.description !== taskData.description) {
|
if (existingTask.description !== taskData.description) {
|
||||||
changes.push(`Description modifiée`);
|
changes.push(`Description modifiée`);
|
||||||
}
|
}
|
||||||
if (existingTask.status !== taskData.status) {
|
if (
|
||||||
changes.push(`Statut: ${existingTask.status} → ${taskData.status}`);
|
existingTask.status === 'archived' &&
|
||||||
|
taskData.status !== 'archived'
|
||||||
|
) {
|
||||||
|
changes.push(`Statut: préservé localement (archived)`);
|
||||||
|
} else if (existingTask.status !== finalStatus) {
|
||||||
|
changes.push(`Statut: ${existingTask.status} → ${finalStatus}`);
|
||||||
}
|
}
|
||||||
if (existingTask.priority !== taskData.priority) {
|
if (existingTask.priority !== taskData.priority) {
|
||||||
changes.push(
|
changes.push(
|
||||||
@@ -612,7 +620,7 @@ export class JiraService {
|
|||||||
} = {
|
} = {
|
||||||
title: finalTitle,
|
title: finalTitle,
|
||||||
description: taskData.description,
|
description: taskData.description,
|
||||||
status: taskData.status,
|
status: finalStatus,
|
||||||
priority: finalPriority,
|
priority: finalPriority,
|
||||||
dueDate: taskData.dueDate,
|
dueDate: taskData.dueDate,
|
||||||
jiraProject: taskData.jiraProject,
|
jiraProject: taskData.jiraProject,
|
||||||
@@ -623,7 +631,7 @@ export class JiraService {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Si la tâche passe à "done" et n'a pas encore de completedAt, le définir
|
// Si la tâche passe à "done" et n'a pas encore de completedAt, le définir
|
||||||
if (taskData.status === 'done' && !existingTask.completedAt) {
|
if (finalStatus === 'done' && !existingTask.completedAt) {
|
||||||
updateData.completedAt = new Date();
|
updateData.completedAt = new Date();
|
||||||
console.log(` ✅ Tâche marquée comme terminée (completedAt défini)`);
|
console.log(` ✅ Tâche marquée comme terminée (completedAt défini)`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user