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:
@@ -337,6 +337,7 @@ def get_events(
|
||||
sync_errors.append({
|
||||
"source": "caldav",
|
||||
"name": f"{account.username} – {calendar.name}",
|
||||
"calendar_id": calendar.id,
|
||||
"message": "Sync fehlgeschlagen",
|
||||
})
|
||||
|
||||
|
||||
@@ -418,6 +418,7 @@ def get_google_events(account: models.GoogleAccount, start_dt: datetime, end_dt:
|
||||
errors.append({
|
||||
"source": "google",
|
||||
"name": f"{account.email} – {gcal.name}",
|
||||
"calendar_id": gcal.id,
|
||||
"message": "Sync fehlgeschlagen",
|
||||
})
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user