PATCH /api/events/<id> updates the event but not its occurrences #67
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#67
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
update_event()writes the new fields to theeventsrow and stops (# TODO: update recurrence table, L844). Calendars, org pages and schedules readevent_occurrences, so an edited event keeps its old title, time and location there.updated_recurrencefrom the web modal is ignored as well.Simply calling
regenerate_event_occurrences_by_event_ids()is not enough: it skips events that have noRecurrenceRule, and one-time events (the common case) have none.How to reproduce
Seed an event and one ONETIME
EventOccurrencefor it, PATCH{"updated_event": {"title": "Renamed"}}as an admin, then GET/api/organizations/org/<org_id>: the response is 200 with title "Renamed", but the occurrence still says the old title.Expected
After a successful PATCH, the event's occurrences match it: title, description, location, start/end and all-day.
Where to look
api/app/api/events.pyupdate_event()(L792-855).api/app/models/event_occurrence.py:regenerate_event_occurrences_by_event_ids()for events with a rule (PATCH setslast_updated_atfirst, so its timestamp check passes); for one-time events,delete_event_occurrences_by_event_id()plussave_event_occurrence(), the same ascreate_event_record()L226-248.2c5f2e9.Done when
api/tests/api/test_event_patch_occurrences.pyfor both (seeapi/tests/factories/recurrence_rule_factory.py)updated_recurrenceis split into a follow-up issue