fix error with tournament count

sync_v2
Razmig Sarkissian 5 months ago
parent 4668dae605
commit 396735e70c
  1. 4
      tournaments/models/team_registration.py
  2. 8
      tournaments/services/tournament_registration.py

@ -188,13 +188,13 @@ class TeamRegistration(SideStoreModel):
matches = self.get_matches()
upcoming = matches.filter(end_date__isnull=True).order_by('start_date')
print(f"Upcoming matches count: {upcoming.count()}")
# print(f"Upcoming matches count: {upcoming.count()}")
return [match.live_match() for match in upcoming]
def get_completed_matches(self):
matches = self.get_matches()
completed = matches.filter(end_date__isnull=False).order_by('-end_date')
print(f"Completed matches count: {completed.count()}")
# print(f"Completed matches count: {completed.count()}")
return [match.live_match() for match in completed]
def get_statistics(self):

@ -412,6 +412,12 @@ class RegistrationCartManager:
else:
sex = None
tournament_count = player_data.get('tournament_count')
try:
tournament_played = int(tournament_count)
except ValueError:
tournament_played = None
# Create player registration with all the original fields
PlayerRegistration.objects.create(
team_registration=team_registration,
@ -423,7 +429,7 @@ class RegistrationCartManager:
last_name=player_data.get('last_name'),
points=player_data.get('points'),
assimilation=player_data.get('assimilation'),
tournament_played=player_data.get('tournament_count'),
tournament_played=tournament_played,
ligue_name=player_data.get('ligue_name'),
club_name=player_data.get('club_name'),
club_code=player_data.get('club_code'),

Loading…
Cancel
Save