From d78fcef6ec55dbaa225c6607bdac430539bf3f0b Mon Sep 17 00:00:00 2001 From: Parker Berberian Date: Mon, 12 Aug 2019 14:18:25 -0400 Subject: 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 --- src/booking/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/booking') 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 -- cgit 1.2.3-korg