fix(fallback): was_full logic
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Luca 2025-05-22 16:10:48 +02:00
parent fd492e7664
commit 42f56e832b
2 changed files with 6 additions and 2 deletions

View File

@ -18,6 +18,10 @@ global_preferences = global_preferences_registry.manager()
@shared_task
def deactivate_fallbacks():
for f in FallbackAssignment.objects.annotate(
real_required_helpers=Case(
When(shift__required_helpers=0, then=F("shift__room__required_helpers")),
default=F("shift__required_helpers"),
),
reg_count=Count(
"shift__shiftregistration",
distinct=True,
@ -32,7 +36,7 @@ def deactivate_fallbacks():
was_full=False,
shift__start_at__lte=timezone.now()
+ global_preferences["helper__min_cancel_time"],
shift__required_helpers__lte=F("reg_count"),
real_required_helpers__lte=F("reg_count"),
):
f.was_full = True
f.save()

View File

@ -77,7 +77,7 @@ Diese Schichtzuteilung wurde maschinell erstellt und ist auch ohne Unterschrift
<tbody>
{% for assignment in assignments %}
{% with assignment.shift as shift %}
<tr{% if shift.registration_count == shift.required_helpers|default:shift.room.required_helpers or assignment.was_full %} class="has-text-grey" style="text-decoration: line-through;"{% endif %}>
<tr{% if assignment.was_full %} class="has-text-grey" style="text-decoration: line-through;"{% endif %}>
<td>{{ assignment.id }} {% if assignment.traded_to %}*{% endif %}</td>
<td>
{{ shift.start_at }}