From aa73c904a487f974800e55e38761499e78a51fee Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Tue, 3 Jun 2025 13:20:21 +0200 Subject: [PATCH] Update tournament_registration.py --- .../services/tournament_registration.py | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/tournaments/services/tournament_registration.py b/tournaments/services/tournament_registration.py index 659f1cf..369b06a 100644 --- a/tournaments/services/tournament_registration.py +++ b/tournaments/services/tournament_registration.py @@ -412,16 +412,22 @@ class RegistrationCartManager: else: sex = None - tournament_count = player_data.get('tournament_count') - try: - tournament_played = int(tournament_count) - except ValueError: + tournament_count = player_data.get('tournament_count', None) + if tournament_count is not None: + try: + tournament_played = int(tournament_count) + except ValueError: + tournament_played = None + else: tournament_played = None - points = player_data.get('points') - try: - points = float(points) - except ValueError: + points = player_data.get('points', None) + if points is not None: + try: + points = float(points) + except ValueError: + points = None + else: points = None # Create player registration with all the original fields