From d81f8cbb0d583dffbb53db96bdec495abb61aa60 Mon Sep 17 00:00:00 2001 From: "Andreas (@xAndy) Zimmermann" Date: Tue, 10 May 2022 22:15:02 +0200 Subject: [PATCH] update can_cancel to respect reservation state --- shiftregister/app/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shiftregister/app/models.py b/shiftregister/app/models.py index d6a529c..a1381c5 100644 --- a/shiftregister/app/models.py +++ b/shiftregister/app/models.py @@ -120,6 +120,8 @@ class ShiftRegistration(models.Model): ) def can_cancel(self): + if self.state != self.REGISTERED: + return false return self.shift.start_at > ( timezone.now() + global_preferences_registry.manager()["helper__min_cancel_time"]