GET /api/events/by_org/<org_id> returns 500 for orgs with imported calendar events #59
Labels
No labels
bug
chore
data
feature
frontend
good first issue
intermediate
needs/docs
needs/research
needs/upstream
type/bug
type/external
type/feature
type/refactor
urgency
high
urgency
immediate
urgency
low
urgency
medium
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
ScottyLabs/cal#59
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What's wrong
event_to_dict()insideget_events_by_organization()readsev.all_dayandev.updated_at. TheEventmodel hasis_all_dayandlast_updated_at, so the route raises AttributeError for any org with at least one event linked to one of its calendar sources (any org that imported an iCal feed). The route has no try/except, so Flask returns its own 500. Orgs without such events get{"events": []}.How to reproduce
Pick an org that has imported an iCal feed:
In tests:
event_factory(org=..., category=..., calendar_source_id=world["cs1"], user_edited=None), then GET/api/events/by_org/{world["org1"]}.Expected
200 with the events. Keep the JSON keys
all_dayandupdated_atso callers do not break; read them fromis_all_dayandlast_updated_at.Where to look
api/app/api/events.pyget_events_by_organization()(L971-999), attributes at L993 and L996.api/app/models/models.pyclass Eventfor the real column names.CalendarSource.org_id), and the web client does not call it today.2c5f2e9.Done when
api/tests/api/test_events_by_org.pycovering that org and an org with none