Agenda refactor

This commit is contained in:
alma 2026-01-15 17:31:41 +01:00
parent 510fbfc3e0
commit 82ad5f2f76

View File

@ -336,8 +336,11 @@ export default async function CalendarPage() {
}
});
console.log(`[AGENDA] Cleanup check: ${syncCountCheck} syncs found for ${allMailCredentialIds.size} mail accounts`);
// Only run full cleanup if there are multiple syncs (likely duplicates)
if (syncCountCheck > allMailCredentialIds.size) {
console.log(`[AGENDA] Running cleanup: ${syncCountCheck} syncs > ${allMailCredentialIds.size} accounts (potential duplicates)`);
const allSyncs = await prisma.calendarSync.findMany({
where: {
calendar: {
@ -580,6 +583,7 @@ export default async function CalendarPage() {
// Exclude "Privée"/"Default" calendars that are not actively synced
if (isPrivateOrDefault && !hasActiveSync) {
console.log(`[AGENDA] Filtering out calendar ${cal.name} (${cal.id}): syncEnabled=${cal.syncConfig?.syncEnabled}, hasMailCredential=${!!cal.syncConfig?.mailCredential}`);
return false;
}
return true;