Skip to content

fix: skip related plannings query when there are no events#2687

Open
dannelundqvist wants to merge 1 commit into
mainfrom
fix/event-view-empty-event-terms
Open

fix: skip related plannings query when there are no events#2687
dannelundqvist wants to merge 1 commit into
mainfrom
fix/event-view-empty-event-terms

Conversation

@dannelundqvist

Copy link
Copy Markdown
Collaborator

Issue

The Event / Events overview list annotates events with related plannings via withPlannings, which builds a terms query on document.rel.event.uuid from the event ids. On dates with no events the id array is empty, and an empty terms.values is dropped on serialization, so the index receives a terms clause with no values and answers with a 500. This is why some dates (no events) consistently fail while dates with events load fine.

Fix

Guard against empty event ids in withPlannings and skip the query when there are none (no events means there are no related plannings to look up). Adds a regression test covering the empty case and the normal case.

Note: it would also be good for the index query endpoint to answer 400 rather than 500 on a malformed terms clause, but that is a separate elephant-index change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant