Centralised ontime calculation #166

This commit is contained in:
Sven Heidemann 2023-01-13 12:23:49 +01:00
parent 3cf0fe3479
commit 34ebb48c83

View File

@ -9,7 +9,6 @@ from cpl_translation import TranslatePipe
from discord import app_commands from discord import app_commands
from discord.ext import commands from discord.ext import commands
from discord.ext.commands import Context 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.client_utils_service_abc import ClientUtilsServiceABC
from bot_core.abc.message_service_abc import MessageServiceABC from bot_core.abc.message_service_abc import MessageServiceABC
@ -159,11 +158,7 @@ class UserGroup(DiscordCommandABC):
value = str(user.xp) value = str(user.xp)
elif atr == 'ontime': elif atr == 'ontime':
value = str(round( value = str(self._client_utils.get_ontime_for_user(user))
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
))
else: else:
await self._message_service.send_interaction_msg( await self._message_service.send_interaction_msg(