aboutsummaryrefslogtreecommitdiffstats
path: root/src/booking
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2019-08-12 14:18:25 -0400
committerParker Berberian <pberberian@iol.unh.edu>2019-08-13 12:49:44 -0400
commitd78fcef6ec55dbaa225c6607bdac430539bf3f0b (patch)
tree653cc5a73b3f2508c8ec93bf3055a3d87497929d /src/booking
parent3418c7a7baae772f1bb58e9a827c1e6198dbed54 (diff)
Adds Downtime Awareness
This adds a Downtime model and relevant operations so that the dashboard knows when a lab is down for maintenance and can act accordingly. This change doesn't modify the front end at all, but it does pass relevant downtime info to the templates so that they can be updated in a future change. Change-Id: Idb88b15838b949f352f11a31a1fce9749d283d28 Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
Diffstat (limited to 'src/booking')
-rw-r--r--src/booking/views.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/booking/views.py b/src/booking/views.py
index bad7dc9..8e25952 100644
--- a/src/booking/views.py
+++ b/src/booking/views.py
@@ -20,7 +20,7 @@ from django.urls import reverse
from resource_inventory.models import ResourceBundle, HostProfile, Image, Host
from resource_inventory.resource_manager import ResourceManager
-from account.models import Lab
+from account.models import Lab, Downtime
from booking.models import Booking
from booking.stats import StatisticsManager
from booking.forms import HostReImageForm
@@ -79,8 +79,9 @@ class BookingView(TemplateView):
def get_context_data(self, **kwargs):
booking = get_object_or_404(Booking, id=self.kwargs['booking_id'])
title = 'Booking Details'
+ downtime = Downtime.objects.filter(lab=booking.lab, start__lt=timezone.now, end__gt=timezone.now()).first()
context = super(BookingView, self).get_context_data(**kwargs)
- context.update({'title': title, 'booking': booking})
+ context.update({'title': title, 'booking': booking, 'downtime': downtime})
return context