From a75baf537ac65bf5a000b24fcae4f318c078589d Mon Sep 17 00:00:00 2001 From: "Andreas (@xAndy) Zimmermann" Date: Tue, 10 May 2022 22:47:35 +0200 Subject: [PATCH] fix current_shift respect registration state --- shiftregister/app/models.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shiftregister/app/models.py b/shiftregister/app/models.py index a1381c5..f4315fc 100644 --- a/shiftregister/app/models.py +++ b/shiftregister/app/models.py @@ -82,7 +82,12 @@ class Helper(models.Model): output_field=models.DateTimeField(), ) ) - .filter(helper=self, shift_end__gte=timezone.now(), shift__deleted=False) + .filter( + helper=self, + shift_end__gte=timezone.now(), + shift__deleted=False, + state__in=[ShiftRegistration.REGISTERED, ShiftRegistration.CHECKED_IN], + ) .order_by("shift__start_at") .first() )