Fix getting invited events with range limits

This commit is contained in:
Peter Vacho 2025-01-02 14:45:53 +01:00
parent 828f4e4aec
commit 82c9aeccb5
Signed by: school
GPG key ID: 8CFC3837052871B4

View file

@ -217,6 +217,7 @@ async def get_user_events(
if end_to is not None:
query = query.find(expr(Event.end_time) <= end_to)
# We can't set this earlier as the other find calls would reset it
query = query.find(fetch_links=True)
events = await query.to_list()
@ -249,7 +250,7 @@ async def get_user_invited_events(
)
# Initial query (all events the user is attending)
query = Event.find(expr(Event.attendees).id == user_id, fetch_links=True)
query = Event.find(expr(Event.attendees).id == user_id)
# Filter by date-time
if start_from is not None:
@ -261,6 +262,9 @@ async def get_user_invited_events(
if end_to is not None:
query = query.find(expr(Event.end_time) <= end_to)
# We can't set this earlier as the other find calls would reset it
query = query.find(fetch_links=True)
events = await query.to_list()
return [EventData.from_event(event) for event in events]