Fix KeyError in Phase 3 recreate: use str(frnr) for adv_map key

- adv_map keys are str, frnr is int, so adv_map[str(frnr)] fixes KeyError
This commit is contained in:
root
2025-10-23 12:44:54 +00:00
parent 9312586f18
commit 0d758b07ea

View File

@@ -555,7 +555,7 @@ async def handler(event, context):
elif row['source_system'] == 'advoware':
# Recreate in Google
try:
new_event_id = await create_google_event(service, calendar_id, standardize_appointment_data(adv_map[frnr], 'advoware'))
new_event_id = await create_google_event(service, calendar_id, standardize_appointment_data(adv_map[str(frnr)], 'advoware'))
async with conn.transaction():
await conn.execute("UPDATE calendar_sync SET google_event_id = $1, sync_status = 'synced', last_sync = $3 WHERE sync_id = $2;", new_event_id, row['sync_id'], datetime.datetime.now(BERLIN_TZ))
logger.info(f"Phase 3: Recreated Google event {new_event_id} for sync_id {row['sync_id']}")