From 1664c67763b0be87542ae2d0da29f003a1de4e99 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sun, 5 Mar 2023 22:32:20 +0100 Subject: [PATCH] Fixed time calculation for user joined gs/vs --- kdb-bot/src/bot_data/model/user_joined_game_server.py | 2 ++ kdb-bot/src/bot_data/model/user_joined_voice_channel.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/kdb-bot/src/bot_data/model/user_joined_game_server.py b/kdb-bot/src/bot_data/model/user_joined_game_server.py index 51fcbed2..90c68d44 100644 --- a/kdb-bot/src/bot_data/model/user_joined_game_server.py +++ b/kdb-bot/src/bot_data/model/user_joined_game_server.py @@ -41,6 +41,8 @@ class UserJoinedGameServer(TableABC): @property def time(self) -> float: + if self._leaved_on is None or self._joined_on is None: + return 0 return round((self.leaved_on - self.joined_on).total_seconds() / 3600, 2) @property diff --git a/kdb-bot/src/bot_data/model/user_joined_voice_channel.py b/kdb-bot/src/bot_data/model/user_joined_voice_channel.py index 928c0341..f99ca0e2 100644 --- a/kdb-bot/src/bot_data/model/user_joined_voice_channel.py +++ b/kdb-bot/src/bot_data/model/user_joined_voice_channel.py @@ -47,6 +47,8 @@ class UserJoinedVoiceChannel(TableABC): @property def time(self) -> float: + if self._leaved_on is None or self._joined_on is None: + return 0 return round((self.leaved_on - self.joined_on).total_seconds() / 3600, 2) @property