2
0
Fork 0

prettify and clear terminal view

This commit is contained in:
Andreas (@xAndy) Zimmermann 2022-05-21 19:20:03 +02:00
parent 1562a1a689
commit 66d226961c
2 changed files with 6 additions and 1 deletions

View File

@ -40,7 +40,7 @@
<td>{{shift.start_at}}</td> <td>{{shift.start_at}}</td>
<td>{{ shift.registration_count }}/{{ shift.required_helpers|default:shift.room.required_helpers }}</td> <td>{{ shift.registration_count }}/{{ shift.required_helpers|default:shift.room.required_helpers }}</td>
<td>{{shift.room.name}} </td> <td>{{shift.room.name}} </td>
<td>{%for item in shift.teambackup_set.all%}<b>{{item.name}}</b>{%empty%} <div class="has-text-danger">unbesetzt</div> {%endfor%}</td> <td><b>{%for item in shift.teambackup_set.all%}{{item.name}}, {%empty%}</b> <div class="has-text-danger">unbesetzt</div> <b>{%endfor%}</b></td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>

View File

@ -8,6 +8,7 @@ from .models import Shift
from .forms import TeamBackupForm from .forms import TeamBackupForm
from datetime import timedelta from datetime import timedelta
from django.db.models import DateTimeField from django.db.models import DateTimeField
from datetime import date, datetime, time
# Create your views here. # Create your views here.
@login_required @login_required
@ -64,6 +65,8 @@ def terminal(request):
help_wanted = Q(required_helpers__gt=F("reg_count")) | Q(required_helpers=0) & Q( help_wanted = Q(required_helpers__gt=F("reg_count")) | Q(required_helpers=0) & Q(
room__required_helpers__gt=F("reg_count") room__required_helpers__gt=F("reg_count")
) )
day = (timezone.now()-timedelta(hours=6))
day = datetime.combine(day, time.min)
shifts = ( shifts = (
Shift.with_reg_count() Shift.with_reg_count()
.annotate( .annotate(
@ -74,6 +77,8 @@ def terminal(request):
) )
.filter( .filter(
help_wanted, help_wanted,
start_at__gte=day + timedelta(hours=5),
start_at__lte=day + timedelta(hours=29),
end_at__gte=timezone.now(), end_at__gte=timezone.now(),
deleted=False, deleted=False,
) )