From 4900a90dc092499aa3e2d14c94fef2ba5f1739ff Mon Sep 17 00:00:00 2001 From: "Andreas (@xAndy) Zimmermann" Date: Wed, 18 May 2022 15:01:57 +0200 Subject: [PATCH] fix team free shift sorting --- shiftregister/team/views.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/shiftregister/team/views.py b/shiftregister/team/views.py index be52c72..79f04f5 100644 --- a/shiftregister/team/views.py +++ b/shiftregister/team/views.py @@ -139,7 +139,11 @@ class FreeShiftList(ShiftList): 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( - help_wanted, - start_at__gt=timezone.now(), + return ( + Shift.with_reg_count() + .filter( + help_wanted, + start_at__gt=timezone.now(), + ) + .order_by("start_at", "room_id") )