Fix getting invited events with range limits
This commit is contained in:
parent
828f4e4aec
commit
82c9aeccb5
|
@ -217,6 +217,7 @@ async def get_user_events(
|
||||||
if end_to is not None:
|
if end_to is not None:
|
||||||
query = query.find(expr(Event.end_time) <= end_to)
|
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)
|
query = query.find(fetch_links=True)
|
||||||
|
|
||||||
events = await query.to_list()
|
events = await query.to_list()
|
||||||
|
@ -249,7 +250,7 @@ async def get_user_invited_events(
|
||||||
)
|
)
|
||||||
|
|
||||||
# Initial query (all events the user is attending)
|
# 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
|
# Filter by date-time
|
||||||
if start_from is not None:
|
if start_from is not None:
|
||||||
|
@ -261,6 +262,9 @@ async def get_user_invited_events(
|
||||||
if end_to is not None:
|
if end_to is not None:
|
||||||
query = query.find(expr(Event.end_time) <= end_to)
|
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()
|
events = await query.to_list()
|
||||||
return [EventData.from_event(event) for event in events]
|
return [EventData.from_event(event) for event in events]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue