@ -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