Skip to content

Commit

Permalink
[sync-calendar] Fix room logic in calendar sync code
Browse files Browse the repository at this point in the history
Calendar synchronization expected the room's name to be readily available under
a calendar's entry, but there's an intermediary `meeting` level to access the
room in practice.
  • Loading branch information
tidoust committed May 30, 2024
1 parent b165af9 commit 6a087b3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tools/lib/calendar.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ async function fillCalendarEntry({ page, entry, session, project, status, zoom }

const room = (project.metadata.rooms === 'hide') ?
null :
project.rooms.find(room => room.name === entry.room);
project.rooms.find(room => room.name === entry.meeting.room);
const roomLocation = (room?.label ?? '') + (room?.location ? ' - ' + room.location : '');
await fillTextInput('input#event_location', roomLocation ?? '');

Expand Down Expand Up @@ -600,9 +600,9 @@ export async function synchronizeSessionWithCalendar(
// sessions in the same plenary. To avoid creating a mess in the calendar,
// we'll throw if one of these sessions has an error that needs fixing.
if (session.description.type === 'plenary') {
const meeting = actions.update[0] ?? actions.create[0];
const meetingEntry = actions.update[0] ?? actions.create[0];
const sessions = project.sessions
.filter(s => s !== session && meetsAt(s, meeting, project));
.filter(s => s !== session && meetsAt(s, meetingEntry.meeting, project));
for (const s of sessions) {
const errors = (await validateSession(s, project))
.filter(error => error.severity === 'error');
Expand Down Expand Up @@ -647,8 +647,8 @@ export async function synchronizeSessionWithCalendar(
}

for (const entry of actions.update) {
console.log(`- refresh calendar entry ${entry.url}, meeting in ${entry.room} on ${entry.day} ${entry.start} - ${entry.end}`);
const room = project.rooms.find(room => room.name === entry.room);
console.log(`- refresh calendar entry ${entry.url}, meeting in ${entry.meeting.room} on ${entry.day} ${entry.start} - ${entry.end}`);
const room = project.rooms.find(room => room.name === entry.meeting.room);
const zoom = project.metadata.rooms === 'hide' ? null : roomZoom[room.label];
entry.url = await updateCalendarEntry({
calendarUrl: entry.url,
Expand All @@ -658,8 +658,8 @@ export async function synchronizeSessionWithCalendar(
}

for (const entry of actions.create) {
console.log(`- create new calendar entry, meeting in ${entry.room} on ${entry.day} ${entry.start} - ${entry.end}`);
const room = project.rooms.find(room => room.name === entry.room);
console.log(`- create new calendar entry, meeting in ${entry.meeting.room} on ${entry.day} ${entry.start} - ${entry.end}`);
const room = project.rooms.find(room => room.name === entry.meeting.room);
const zoom = project.metadata.rooms === 'hide' ? null : roomZoom[room.label];
entry.url = await updateCalendarEntry({
calendarUrl: null,
Expand Down

0 comments on commit 6a087b3

Please sign in to comment.