Skip to content
Snippets Groups Projects
Commit 01536379 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

TMSS-652: handle None parameters

parent f46a5c9f
No related branches found
No related tags found
1 merge request!403Resolve TMSS-652 and TMSS-714
......@@ -6,8 +6,15 @@ def get_active_station_reservations_in_timewindow(lower_bound, upper_bound):
Retrieve a list of all active stations reservations, which are reserved between a timewindow
"""
lst_active_station_reservations = []
for res in models.Reservation.objects.filter(start_time__lt=upper_bound, stop_time__gt=lower_bound).values('specifications_doc'):
lst_active_station_reservations += res["specifications_doc"]["resources"]["stations"]
for res in models.Reservation.objects.filter(start_time__lt=upper_bound, stop_time=None).values('specifications_doc'):
if upper_bound is None:
queryset = models.Reservation.objects.filter(start_time__lt=upper_bound)
else:
queryset = models.Reservation.objects.all()
for res in queryset.filter(stop_time=None).values('specifications_doc'):
lst_active_station_reservations += res["specifications_doc"]["resources"]["stations"]
if lower_bound is not None:
for res in queryset.filter(stop_time__gt=lower_bound).values('specifications_doc'):
lst_active_station_reservations += res["specifications_doc"]["resources"]["stations"]
return list(set(lst_active_station_reservations))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment