fixing some errors

This commit is contained in:
CHIBOUB Chakib 2024-09-11 17:19:31 +02:00
parent 4d69a84bdd
commit 730431736a
3 changed files with 5 additions and 7 deletions

View File

@ -244,9 +244,11 @@ class Game:
if not self.localgame:
await self.player2.send(end_message)
if hasattr(self, 'tournament'):
print(f"*** Game #{self.game_id} from tournament: {self.tournament.tournoi_reg.name} ENDED ***")
await sync_to_async(handle_game_data)(self.game_state['player1_name'], self.game_state['player2_name'],
self.game_state['player1_score'], self.game_state['player2_score'],
self.bt1, self.bt2, duration, True, self.tournament.tournoi_reg)
print(f"*** Game #{self.game_id} from tournament: {self.tournament.tournoi_reg.name} is REGISTERED ***")
else:
await sync_to_async(handle_game_data)(self.game_state['player1_name'], self.game_state['player2_name'],
self.game_state['player1_score'], self.game_state['player2_score'],

View File

@ -10,13 +10,6 @@ from .models import Tournoi
from .utils import create_tournament, update_tournament, getlen
from asgiref.sync import sync_to_async
TOURNAMENT_NAMES = [
"Champions Clash", "Ultimate Showdown", "Battle Royale",
"Victory Cup", "Legends Tournament", "Elite Series", "Clash of 42",
"Shibuya incident", "Cunning Game", "Elite of the Stars"
]
TOURNAMENT_NAMES = [
"Champion's Clash", "Ultimate Showdown", "Battle Royale",
"Victory's Cup", "Legends Tournament", "Elite Series", "Clash of 42",
@ -214,6 +207,7 @@ class TournamentMatchMaker:
self.rounds = []
self.current_round = 0
self.games = 0
self.tournament_state = "waiting"
async def handle_match_end(self, match):
await self.update_brackets()

View File

@ -10,7 +10,9 @@ def handle_game_data(p1, p2, s_p1, s_p2, bt_p1, bt_2, dur, is_tournoi, name_tour
player_1 = get_or_create_player(p1)
player_2 = get_or_create_player(p2)
print("CHAKU & THEOUCHE are the BEST")
create_match(player_1, player_2, s_p1, s_p2, bt_p1, bt_2, dur, is_tournoi, name_tournament)
print("and ADRIANO is the PEST")
update_player_statistics(p1)
update_player_statistics(p2)