|
|
@ -40,7 +40,7 @@ def shift_overview(request):
|
|
|
|
Shift.objects.filter(room=room, start_at__gt=timezone.now(), deleted=False)
|
|
|
|
Shift.objects.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()
|
|
|
|
for room in Room.objects.all().order_by("name")
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
@ -187,7 +187,7 @@ class ShiftList(LoginRequiredMixin, ListView):
|
|
|
|
return context
|
|
|
|
return context
|
|
|
|
|
|
|
|
|
|
|
|
def get_ordering(self):
|
|
|
|
def get_ordering(self):
|
|
|
|
return ("start_at", "room_id")
|
|
|
|
return ("start_at", "room__name")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class FreeShiftList(ShiftList):
|
|
|
|
class FreeShiftList(ShiftList):
|
|
|
@ -210,7 +210,29 @@ class FreeShiftList(ShiftList):
|
|
|
|
end_at__gte=timezone.now(),
|
|
|
|
end_at__gte=timezone.now(),
|
|
|
|
deleted=False,
|
|
|
|
deleted=False,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.order_by("start_at", "room_id")
|
|
|
|
.order_by("start_at", "room__name")
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class RoomShiftList(ShiftList):
|
|
|
|
|
|
|
|
def get_context_data(self, **kwargs):
|
|
|
|
|
|
|
|
room = get_object_or_404(Room, pk=self.kwargs["pk"])
|
|
|
|
|
|
|
|
context = super().get_context_data(**kwargs)
|
|
|
|
|
|
|
|
context["title"] = f"Schichten fuer {room.name}"
|
|
|
|
|
|
|
|
return context
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_queryset(self):
|
|
|
|
|
|
|
|
room = get_object_or_404(Room, pk=self.kwargs["pk"])
|
|
|
|
|
|
|
|
help_wanted = Q(required_helpers__gt=F("reg_count")) | Q(
|
|
|
|
|
|
|
|
required_helpers=0
|
|
|
|
|
|
|
|
) & Q(room__required_helpers__gt=F("reg_count"))
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
Shift.with_reg_count()
|
|
|
|
|
|
|
|
.filter(
|
|
|
|
|
|
|
|
deleted=False,
|
|
|
|
|
|
|
|
room=room,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.order_by("start_at", "room__name")
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|