diff --git a/shiftregister/fallback/templates/my_fallback_shifts.html b/shiftregister/fallback/templates/my_fallback_shifts.html
index 975e96b..77dac5d 100644
--- a/shiftregister/fallback/templates/my_fallback_shifts.html
+++ b/shiftregister/fallback/templates/my_fallback_shifts.html
@@ -75,17 +75,12 @@ Diese Schichtzuteilung wurde maschinell erstellt und ist auch ohne Unterschrift
{{ shift.room.name }}
{{ shift.registration_count }}/{{ shift.required_helpers|default:shift.room.required_helpers }}
-{% for fa in shift.fallbackassignment_set.all %}
- {% if fa.traded_to %}
- {{ fa.traded_to.name }}
- {% else %}
- {{ fa.team_member.name }}
- {% endif %}
- {% if not forloop.last %}, {% endif %}
-{% endfor %}
+{% for fa in shift.fallbackassignment_set.all %}{% if fa.traded_to %}{{ fa.traded_to.name }}{% else %}{{ fa.team_member.name }}{% endif %}{% if not forloop.last %}, {% endif %}{% endfor %}
-{% if shift.registration_count < shift.required_helpers|default:shift.room.required_helpers %}
+{% if assignment.restricted %}
+ Nur Team
+{% elif shift.registration_count < shift.required_helpers|default:shift.room.required_helpers %}
Mithelfen
{% endif %}
diff --git a/shiftregister/fallback/views.py b/shiftregister/fallback/views.py
index 3844770..c0dda4e 100644
--- a/shiftregister/fallback/views.py
+++ b/shiftregister/fallback/views.py
@@ -3,6 +3,7 @@ from base64 import urlsafe_b64decode
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.db.models import Count, Q
+from django.db.models.functions import Coalesce
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.urls import reverse
@@ -61,11 +62,14 @@ def my_fallback_shifts(request, team_member_id):
messages.error(request, "Ungültige Schicht-ID")
assignments = (
- FallbackAssignment.objects.filter(
+ FallbackAssignment.objects.select_related(
+ "shift__event__calendar", "traded_to", "team_member"
+ )
+ .annotate(restricted=Coalesce("shift__event__calendar__restricted", False))
+ .filter(
Q(team_member=team_member, traded_to__isnull=True)
| Q(traded_to=team_member)
)
- .prefetch_related("shift", "traded_to", "team_member")
.order_by("shift__start_at")
)