show free count for helpers as well, use db to calculate
This commit is contained in:
parent
420beed018
commit
f076154ab0
|
@ -8,7 +8,8 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<strong>Ort:</strong> {{ shift.room.name }}<br>
|
<strong>Ort:</strong> {{ shift.room.name }}<br>
|
||||||
<strong>Beginn:</strong> {{ shift.start_at }}<br>
|
<strong>Beginn:</strong> {{ shift.start_at }}<br>
|
||||||
<strong>Dauer:</strong> {{ shift.duration|duration }}
|
<strong>Dauer:</strong> {{ shift.duration|duration }}</br>
|
||||||
|
<strong>Belegung:</strong> {{ shift.reg_count }}/{{ shift.required_helpers|default:shift.room.required_helpers }}
|
||||||
</div>
|
</div>
|
||||||
<div class="buttons is-right">
|
<div class="buttons is-right">
|
||||||
<a class="button is-info is-small mr-0" href="{% url 'shift' shift.id %}">Details</a>
|
<a class="button is-info is-small mr-0" href="{% url 'shift' shift.id %}">Details</a>
|
||||||
|
|
|
@ -20,7 +20,8 @@
|
||||||
<strong>Ort:</strong> <a href="{% url 'pages:view' 'map' %}#{{ shift.room.name|slugify }}">{{ shift.room.name }} 📍</a><br>
|
<strong>Ort:</strong> <a href="{% url 'pages:view' 'map' %}#{{ shift.room.name|slugify }}">{{ shift.room.name }} 📍</a><br>
|
||||||
<strong>Beginn:</strong> {{ shift.start_at }}<br>
|
<strong>Beginn:</strong> {{ shift.start_at }}<br>
|
||||||
<strong>Dauer:</strong> {{ shift.duration|duration }}<br>
|
<strong>Dauer:</strong> {{ shift.duration|duration }}<br>
|
||||||
<strong>Treffpunkt:</strong> {{ shift.room.meeting_location|linebreaksbr }}
|
<strong>Treffpunkt:</strong> {{ shift.room.meeting_location|linebreaksbr }}<br>
|
||||||
|
<strong>Belegung:</strong> {{ shift.shiftregistration_set.count }}/{{ shift.required_helpers|default:shift.room.required_helpers }}
|
||||||
</p>
|
</p>
|
||||||
{% if shift.room.description %}
|
{% if shift.room.description %}
|
||||||
<div class="description">
|
<div class="description">
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<strong>Ort:</strong> {{ shift.room.name }}<br>
|
<strong>Ort:</strong> {{ shift.room.name }}<br>
|
||||||
<strong>Beginn:</strong> {{ shift.start_at }}<br>
|
<strong>Beginn:</strong> {{ shift.start_at }}<br>
|
||||||
<strong>Dauer:</strong> {{ shift.duration }}<br>
|
<strong>Dauer:</strong> {{ shift.duration }}<br>
|
||||||
<strong>Belegung:</strong> {{ shift.shiftregistration_set.count }}/{{ shift.required_helpers|default:shift.room.required_helpers }}
|
<strong>Belegung:</strong> {{ shift.reg_count}}/{{ shift.required_helpers|default:shift.room.required_helpers }}
|
||||||
{% if shift.teambackup_set.all.count %}
|
{% if shift.teambackup_set.all.count %}
|
||||||
<br>
|
<br>
|
||||||
<strong>Backup-Teammitglied(er):</strong> {% for member in shift.teambackup_set.all %}{{ member.name }}{% if not forloop.last %}, {% endif %}{% endfor %}
|
<strong>Backup-Teammitglied(er):</strong> {% for member in shift.teambackup_set.all %}{{ member.name }}{% if not forloop.last %}, {% endif %}{% endfor %}
|
||||||
|
|
|
@ -23,7 +23,8 @@ def shift_overview(request):
|
||||||
context = {}
|
context = {}
|
||||||
context["running_shifts"] = [
|
context["running_shifts"] = [
|
||||||
shift
|
shift
|
||||||
for shift in Shift.objects.annotate(
|
for shift in Shift.with_reg_count()
|
||||||
|
.annotate(
|
||||||
end_at=ExpressionWrapper(
|
end_at=ExpressionWrapper(
|
||||||
F("start_at") + F("duration"),
|
F("start_at") + F("duration"),
|
||||||
output_field=DateTimeField(),
|
output_field=DateTimeField(),
|
||||||
|
@ -37,7 +38,8 @@ def shift_overview(request):
|
||||||
context["next_shifts"] = filter(
|
context["next_shifts"] = filter(
|
||||||
lambda x: x is not None,
|
lambda x: x is not None,
|
||||||
(
|
(
|
||||||
Shift.objects.filter(room=room, start_at__gt=timezone.now(), deleted=False)
|
Shift.with_reg_count()
|
||||||
|
.filter(room=room, start_at__gt=timezone.now(), deleted=False)
|
||||||
.order_by("start_at")
|
.order_by("start_at")
|
||||||
.first()
|
.first()
|
||||||
for room in Room.objects.all().order_by("name")
|
for room in Room.objects.all().order_by("name")
|
||||||
|
@ -181,6 +183,9 @@ class ShiftList(LoginRequiredMixin, ListView):
|
||||||
model = Shift
|
model = Shift
|
||||||
title = "Alle Schichten"
|
title = "Alle Schichten"
|
||||||
|
|
||||||
|
def get_queryset(self):
|
||||||
|
return Shift.with_reg_count()
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context["title"] = self.title
|
context["title"] = self.title
|
||||||
|
|
Loading…
Reference in New Issue