fix: include calendar_id in per-calendar sync errors

Events already carry calendar_id, but the corresponding sync-error
entries didn't, forcing clients to match errors to calendars by
fragile name-suffix comparison. Account-level failures (whole account
unreachable) still omit calendar_id since no single calendar is at fault.
This commit is contained in:
Scarriffle
2026-07-02 18:36:46 +02:00
parent 9fb350eb29
commit e0ea16f2ef
3 changed files with 5 additions and 2 deletions

View File

@@ -317,8 +317,8 @@ def get_ha_events(account: models.HomeAssistantAccount, start_dt: datetime, end_
"""Fetch events from all enabled HA calendars for an account.
Returns (events, errors) — errors is a list of
{"source": "homeassistant", "name": ..., "message": ...} dicts for any
calendar that failed to sync. Never includes raw exception text.
{"source": "homeassistant", "name": ..., "calendar_id": ..., "message": ...}
dicts for any calendar that failed to sync. Never includes raw exception text.
"""
all_events = []
errors = []
@@ -340,6 +340,7 @@ def get_ha_events(account: models.HomeAssistantAccount, start_dt: datetime, end_
errors.append({
"source": "homeassistant",
"name": f"{account.name} {cal.name}",
"calendar_id": cal.id,
"message": "Sync fehlgeschlagen",
})
return all_events, errors