chore(fallback): mark team-only shifts as such in fallback shifts view
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
d466a744b9
commit
1dc92cba19
|
@ -75,17 +75,12 @@ Diese Schichtzuteilung wurde maschinell erstellt und ist auch ohne Unterschrift
|
||||||
<td>{{ shift.room.name }} </td>
|
<td>{{ shift.room.name }} </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>
|
<td>
|
||||||
{% for fa in shift.fallbackassignment_set.all %}
|
{% 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 fa.traded_to %}
|
|
||||||
{{ fa.traded_to.name }}
|
|
||||||
{% else %}
|
|
||||||
{{ fa.team_member.name }}
|
|
||||||
{% endif %}
|
|
||||||
{% if not forloop.last %}, {% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{% if shift.registration_count < shift.required_helpers|default:shift.room.required_helpers %}
|
{% if assignment.restricted %}
|
||||||
|
<button class="button is-primary is-small mr-0" disabled>Nur Team</button>
|
||||||
|
{% elif shift.registration_count < shift.required_helpers|default:shift.room.required_helpers %}
|
||||||
<a class="button is-primary is-small mr-0" href="{% url 'shift' shift.id %}">Mithelfen</a>
|
<a class="button is-primary is-small mr-0" href="{% url 'shift' shift.id %}">Mithelfen</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -3,6 +3,7 @@ from base64 import urlsafe_b64decode
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.db.models import Count, Q
|
from django.db.models import Count, Q
|
||||||
|
from django.db.models.functions import Coalesce
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.shortcuts import get_object_or_404, redirect, render
|
from django.shortcuts import get_object_or_404, redirect, render
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
@ -61,11 +62,14 @@ def my_fallback_shifts(request, team_member_id):
|
||||||
messages.error(request, "Ungültige Schicht-ID")
|
messages.error(request, "Ungültige Schicht-ID")
|
||||||
|
|
||||||
assignments = (
|
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(team_member=team_member, traded_to__isnull=True)
|
||||||
| Q(traded_to=team_member)
|
| Q(traded_to=team_member)
|
||||||
)
|
)
|
||||||
.prefetch_related("shift", "traded_to", "team_member")
|
|
||||||
.order_by("shift__start_at")
|
.order_by("shift__start_at")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue