Centralised ontime calculation #166
This commit is contained in:
		@@ -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(
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user