Agenda refactor
This commit is contained in:
parent
c6ce56f469
commit
d77bbf3c16
@ -343,7 +343,7 @@ export async function syncMicrosoftCalendar(
|
||||
endDate
|
||||
);
|
||||
|
||||
// Log all events, not just first 10
|
||||
// Log all events with full details
|
||||
logger.info('Fetched Microsoft events', {
|
||||
calendarSyncId,
|
||||
eventCount: microsoftEvents.length,
|
||||
@ -353,13 +353,38 @@ export async function syncMicrosoftCalendar(
|
||||
},
|
||||
allEvents: microsoftEvents.map(e => ({
|
||||
id: e.id,
|
||||
subject: e.subject,
|
||||
subject: e.subject || '(sans titre)',
|
||||
start: e.start.dateTime || e.start.date,
|
||||
isAllDay: e.isAllDay,
|
||||
end: e.end.dateTime || e.end.date
|
||||
end: e.end.dateTime || e.end.date,
|
||||
// Log full start/end objects to debug
|
||||
startObj: e.start,
|
||||
endObj: e.end
|
||||
})),
|
||||
});
|
||||
|
||||
// Check if "Test" event is in the list
|
||||
const testEvent = microsoftEvents.find(e =>
|
||||
e.subject && e.subject.toLowerCase().includes('test')
|
||||
);
|
||||
if (testEvent) {
|
||||
logger.info('Found "Test" event in Microsoft response', {
|
||||
calendarSyncId,
|
||||
testEvent: {
|
||||
id: testEvent.id,
|
||||
subject: testEvent.subject,
|
||||
start: testEvent.start.dateTime || testEvent.start.date,
|
||||
isAllDay: testEvent.isAllDay,
|
||||
}
|
||||
});
|
||||
} else {
|
||||
logger.warn('"Test" event NOT found in Microsoft response', {
|
||||
calendarSyncId,
|
||||
totalEvents: microsoftEvents.length,
|
||||
eventSubjects: microsoftEvents.map(e => e.subject || '(sans titre)'),
|
||||
});
|
||||
}
|
||||
|
||||
if (microsoftEvents.length === 0) {
|
||||
logger.warn('No Microsoft events found in date range', {
|
||||
calendarSyncId,
|
||||
@ -377,12 +402,31 @@ export async function syncMicrosoftCalendar(
|
||||
logger.info('Microsoft events in the future', {
|
||||
calendarSyncId,
|
||||
futureEventCount: futureEvents.length,
|
||||
futureEvents: futureEvents.slice(0, 5).map(e => ({
|
||||
totalEvents: microsoftEvents.length,
|
||||
futureEvents: futureEvents.map(e => ({
|
||||
id: e.id,
|
||||
subject: e.subject,
|
||||
subject: e.subject || '(sans titre)',
|
||||
start: e.start.dateTime || e.start.date,
|
||||
isAllDay: e.isAllDay,
|
||||
})),
|
||||
});
|
||||
|
||||
// Also log events in the past to see all events
|
||||
const pastEvents = microsoftEvents.filter(e => {
|
||||
const eventStart = e.start.dateTime || e.start.date;
|
||||
return new Date(eventStart) <= now;
|
||||
});
|
||||
if (pastEvents.length > 0) {
|
||||
logger.info('Microsoft events in the past', {
|
||||
calendarSyncId,
|
||||
pastEventCount: pastEvents.length,
|
||||
pastEvents: pastEvents.map(e => ({
|
||||
id: e.id,
|
||||
subject: e.subject || '(sans titre)',
|
||||
start: e.start.dateTime || e.start.date,
|
||||
})),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Convert Microsoft events to CalDAV-like format
|
||||
|
||||
Loading…
Reference in New Issue
Block a user