summaryrefslogtreecommitdiffstats
path: root/dashboard/src
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2019-06-21 10:04:38 -0400
committerParker Berberian <pberberian@iol.unh.edu>2019-06-21 10:04:38 -0400
commit7a8eb69cae1e1b35b8ca3630c665678e2cae117e (patch)
tree6a961a6a41425df66acb12dd9ed21211e97c7a89 /dashboard/src
parentbf7986421192be9018c662e016fabb02d2dad0da (diff)
Prefetches Collaborators
Prefetches collaborators to further reduce database accesses Change-Id: I5a976c4e17e20ca463576178371f70e59551b576 Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
Diffstat (limited to 'dashboard/src')
-rw-r--r--dashboard/src/booking/stats.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/dashboard/src/booking/stats.py b/dashboard/src/booking/stats.py
index 62ba648..383723a 100644
--- a/dashboard/src/booking/stats.py
+++ b/dashboard/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)