separate elk to prject

This commit is contained in:
Adrien Audebert
2024-09-13 15:14:21 +02:00
parent fc34fd2174
commit f06bb700ae
5 changed files with 234 additions and 171 deletions

View File

@@ -12,8 +12,8 @@ def handle_game_data(p1, p2, s_p1, s_p2, bt_p1, bt_2, dur, is_tournoi, name_tour
create_match(player_1, player_2, s_p1, s_p2, bt_p1, bt_2, dur, is_tournoi, name_tournament)
update_player_statistics(p1)
update_player_statistics(p2)
#update_player_statistics(p1)
#update_player_statistics(p2)
except Exception as e:
print(f"Error in endfortheouche: {e}")
@@ -65,6 +65,7 @@ def create_player(
m_duration=m_duration,
num_participated_tournaments=num_participated_tournaments,
num_won_tournaments=num_won_tournaments
)
player.save()
return player
@@ -128,7 +129,7 @@ def update_player_statistics(player_name):
total_score = matches_as_player1.aggregate(Sum('score_player1'))['score_player1__sum'] or 0
total_score += matches_as_player2.aggregate(Sum('score_player2'))['score_player2__sum'] or 0
total_score_adv = matches_as_player1.aggregate(Sum('score_player2'))['score_player2__sum'] or 0
total_score_adv += matches_as_player2.aggregate(Sum('score_player1'))['score_player1__sum'] or 0

View File

@@ -136,6 +136,32 @@ CHANNEL_LAYERS = {
},
}
LOGGING = {
'version': 1, # Django requires this key
'disable_existing_loggers': False, # Keep Django's default loggers
'formatters': {
'simple': {
'format': '{levelname} {message}',
'style': '{', # Allows to use Python's new style string formatting
},
},
'handlers': {
'console': { # Log to the console
'level': 'DEBUG', # Minimum level of messages that should be handled
'class': 'logging.StreamHandler',
'formatter': 'simple', # Use the simple formatter defined above
},
},
'loggers': {
'django': { # The main logger for Django itself
'handlers': ['console'],
'level': 'DEBUG', # Minimum log level to be logged
'propagate': False, # Prevents log propagation to other loggers
},
},
}
"""
LOGGING = {
'version': 1, # The version of the logging configuration schema
'disable_existing_loggers': False, # Allows existing loggers to keep logging
@@ -170,3 +196,4 @@ LOGGING = {
},
},
}
"""