From 34ebb48c831b25f56e89fb7950ae09903355bc14 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Fri, 13 Jan 2023 12:23:49 +0100 Subject: [PATCH] Centralised ontime calculation #166 --- kdb-bot/src/modules/base/command/user_group.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/kdb-bot/src/modules/base/command/user_group.py b/kdb-bot/src/modules/base/command/user_group.py index f0b5844e..b0f41230 100644 --- a/kdb-bot/src/modules/base/command/user_group.py +++ b/kdb-bot/src/modules/base/command/user_group.py @@ -9,7 +9,6 @@ from cpl_translation import TranslatePipe from discord import app_commands from discord.ext import commands from discord.ext.commands import Context -from mysql.connector.errors import DatabaseError from bot_core.abc.client_utils_service_abc import ClientUtilsServiceABC from bot_core.abc.message_service_abc import MessageServiceABC @@ -159,11 +158,7 @@ class UserGroup(DiscordCommandABC): value = str(user.xp) elif atr == 'ontime': - value = str(round( - self._user_joined_voice_channel.get_user_joined_voice_channels_by_user_id(user.user_id) - .sum(lambda join: (join.leaved_on - join.joined_on).total_seconds() / 3600), - 2 - )) + value = str(self._client_utils.get_ontime_for_user(user)) else: await self._message_service.send_interaction_msg(