From 66d226961cb7fe81a0d7701490f9eb3f1ba02364 Mon Sep 17 00:00:00 2001 From: "Andreas (@xAndy) Zimmermann" Date: Sat, 21 May 2022 19:20:03 +0200 Subject: [PATCH] prettify and clear terminal view --- shiftregister/signage/templates/terminal.html | 2 +- shiftregister/signage/views.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/shiftregister/signage/templates/terminal.html b/shiftregister/signage/templates/terminal.html index 99aac46..a15ca30 100644 --- a/shiftregister/signage/templates/terminal.html +++ b/shiftregister/signage/templates/terminal.html @@ -40,7 +40,7 @@ {{shift.start_at}} {{ shift.registration_count }}/{{ shift.required_helpers|default:shift.room.required_helpers }} {{shift.room.name}} - {%for item in shift.teambackup_set.all%}{{item.name}}{%empty%}
unbesetzt
{%endfor%} + {%for item in shift.teambackup_set.all%}{{item.name}}, {%empty%}
unbesetzt
{%endfor%} {% endfor %} diff --git a/shiftregister/signage/views.py b/shiftregister/signage/views.py index 06b1e73..9d2eeb3 100644 --- a/shiftregister/signage/views.py +++ b/shiftregister/signage/views.py @@ -8,6 +8,7 @@ from .models import Shift from .forms import TeamBackupForm from datetime import timedelta from django.db.models import DateTimeField +from datetime import date, datetime, time # Create your views here. @login_required @@ -64,6 +65,8 @@ def terminal(request): help_wanted = Q(required_helpers__gt=F("reg_count")) | Q(required_helpers=0) & Q( room__required_helpers__gt=F("reg_count") ) + day = (timezone.now()-timedelta(hours=6)) + day = datetime.combine(day, time.min) shifts = ( Shift.with_reg_count() .annotate( @@ -74,6 +77,8 @@ def terminal(request): ) .filter( help_wanted, + start_at__gte=day + timedelta(hours=5), + start_at__lte=day + timedelta(hours=29), end_at__gte=timezone.now(), deleted=False, )