Widget Devoir Finition
This commit is contained in:
parent
243e88f398
commit
3f4779ddf0
@ -359,14 +359,34 @@ export function Duties() {
|
||||
setTasks(sortedTasks);
|
||||
|
||||
// Dispatch event for Outlook-style notifications (when tasks are due)
|
||||
const tasksForNotification = sortedTasks.map(task => ({
|
||||
id: task.id.toString(),
|
||||
headline: task.headline,
|
||||
dateToFinish: task.dateToFinish,
|
||||
source: (task as any).source || 'leantime',
|
||||
projectName: task.projectName,
|
||||
url: (task as any).url || null,
|
||||
}));
|
||||
// Filter out done tasks one more time before sending to notifications
|
||||
const tasksForNotification = sortedTasks
|
||||
.filter(task => {
|
||||
const rawStatus = (task as any).status;
|
||||
if (rawStatus === null || rawStatus === undefined) {
|
||||
return true; // Keep tasks without status
|
||||
}
|
||||
const taskStatus = typeof rawStatus === 'string' ? parseInt(rawStatus, 10) : rawStatus;
|
||||
const statusStr = typeof rawStatus === 'string' ? rawStatus.toLowerCase().trim() : String(rawStatus).toLowerCase().trim();
|
||||
const isDone = taskStatus === 3 || taskStatus === 5 || statusStr === '3' || statusStr === '5' || statusStr === 'done';
|
||||
if (isDone) {
|
||||
console.warn('[Devoirs Widget] ⚠️ Filtering out done task before notification:', {
|
||||
id: task.id,
|
||||
headline: task.headline,
|
||||
status: rawStatus,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.map(task => ({
|
||||
id: task.id.toString(),
|
||||
headline: task.headline,
|
||||
dateToFinish: task.dateToFinish,
|
||||
source: (task as any).source || 'leantime',
|
||||
projectName: task.projectName,
|
||||
url: (task as any).url || null,
|
||||
}));
|
||||
|
||||
console.log('[Devoirs Widget] 📋 Dispatching tasks update', {
|
||||
tasksCount: tasksForNotification.length,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user