summaryrefslogtreecommitdiffstats
path: root/src/booking
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2019-06-24 18:02:21 +0000
committerGerrit Code Review <gerrit@opnfv.org>2019-06-24 18:02:21 +0000
commitd98ddb1cdf6d9dcd0ad79d12dd12d6c23a6ea2ba (patch)
tree86882eead7372abba16e2e2d92e8c36370078e89 /src/booking
parent46f31a6df95a4d071ef49acf5a1dfb3ceecf0ea3 (diff)
parente621a5182f387ab2b666e4c65e655b56139998d3 (diff)
Merge "Prefetches Collaborators"
Diffstat (limited to 'src/booking')
-rw-r--r--src/booking/stats.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/booking/stats.py b/src/booking/stats.py
index 62ba648..383723a 100644
--- a/src/booking/stats.py
+++ b/src/booking/stats.py
@@ -32,7 +32,7 @@ class StatisticsManager(object):
now = datetime.datetime.now(pytz.utc)
delta = datetime.timedelta(days=span)
end = now - delta
- bookings = Booking.objects.filter(start__lte=now, end__gte=end)
+ bookings = Booking.objects.filter(start__lte=now, end__gte=end).prefetch_related("collaborators")
for booking in bookings: # collect data from each booking
user_list = [u.pk for u in booking.collaborators.all()]
user_list.append(booking.owner.pk)