From be2a01840cac0208d17068b473d058ebca6fcfd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Mon, 17 Mar 2025 08:35:48 +0100 Subject: [PATCH] Fix != None --- games/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/games/models.py b/games/models.py index e1279d4..e01f754 100644 --- a/games/models.py +++ b/games/models.py @@ -284,7 +284,7 @@ class Session(models.Model): calculated = timedelta(0) if self.is_manual() and isinstance(self.duration_manual, timedelta): manual = self.duration_manual - if self.timestamp_end != None and self.timestamp_start != None: + if self.timestamp_end is not None and self.timestamp_start is not None: calculated = self.timestamp_end - self.timestamp_start return timedelta(seconds=(manual + calculated).total_seconds()) @@ -300,7 +300,7 @@ class Session(models.Model): return Session.objects.all().total_duration_formatted() def save(self, *args, **kwargs) -> None: - if self.timestamp_start != None and self.timestamp_end != None: + if self.timestamp_start is not None and self.timestamp_end is not None: self.duration_calculated = self.timestamp_end - self.timestamp_start else: self.duration_calculated = timedelta(0)