diff options
author | Parker Berberian <pberberian@iol.unh.edu> | 2019-06-24 18:02:21 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2019-06-24 18:02:21 +0000 |
commit | d98ddb1cdf6d9dcd0ad79d12dd12d6c23a6ea2ba (patch) | |
tree | 86882eead7372abba16e2e2d92e8c36370078e89 | |
parent | 46f31a6df95a4d071ef49acf5a1dfb3ceecf0ea3 (diff) | |
parent | e621a5182f387ab2b666e4c65e655b56139998d3 (diff) |
Merge "Prefetches Collaborators"
-rw-r--r-- | src/booking/stats.py | 2 |
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) |