Widget Devoir Finition

This commit is contained in:
alma 2026-01-24 13:26:44 +01:00
parent 243e88f398
commit 3f4779ddf0

View File

@ -359,7 +359,27 @@ export function Duties() {
setTasks(sortedTasks); setTasks(sortedTasks);
// Dispatch event for Outlook-style notifications (when tasks are due) // Dispatch event for Outlook-style notifications (when tasks are due)
const tasksForNotification = sortedTasks.map(task => ({ // 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(), id: task.id.toString(),
headline: task.headline, headline: task.headline,
dateToFinish: task.dateToFinish, dateToFinish: task.dateToFinish,