From eb05fcb9b18654e6ec591ba8e38b8ede35ea2a07 Mon Sep 17 00:00:00 2001 From: Raz Date: Sat, 5 Apr 2025 22:36:13 +0200 Subject: [PATCH 1/2] fix register tournament --- tournaments/repositories.py | 1 - tournaments/services/tournament_registration.py | 9 +++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/tournaments/repositories.py b/tournaments/repositories.py index 634a835..d30f636 100644 --- a/tournaments/repositories.py +++ b/tournaments/repositories.py @@ -1,4 +1,3 @@ -from django.utils import timezone from .models import TeamRegistration, PlayerRegistration from .models.player_enums import PlayerSexType, PlayerDataSource from .models.enums import FederalCategory diff --git a/tournaments/services/tournament_registration.py b/tournaments/services/tournament_registration.py index 258b69f..019ef29 100644 --- a/tournaments/services/tournament_registration.py +++ b/tournaments/services/tournament_registration.py @@ -72,13 +72,10 @@ class TournamentRegistrationService: if self._is_already_registered(licence_id): return - if self.request.user.is_authenticated and self.request.user.licence_id is None: + if self.request.user.is_authenticated and self.request.user.licence_id is None and len(self.context['current_players']) == 0: if self._update_user_license(player_data.get('licence_id')) == False: - return - - if self.request.user.licence_id is None and len(self.context['current_players']) == 0: - # if no licence id for authentificated user and trying to add him as first player of the team, we check his federal data - self._handle_invalid_names(licence_id, player_data) + # if no licence id for authentificated user and trying to add him as first player of the team, we check his federal data + self._handle_invalid_names(licence_id, player_data) else: # Handle player data if self.context['add_player_form'].names_is_valid(): From aa630d13480329eae9a6592f2d66f812205e7672 Mon Sep 17 00:00:00 2001 From: Raz Date: Sat, 5 Apr 2025 22:40:23 +0200 Subject: [PATCH 2/2] fix register tournament --- tournaments/views.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tournaments/views.py b/tournaments/views.py index 1276e17..61ca4a8 100644 --- a/tournaments/views.py +++ b/tournaments/views.py @@ -54,6 +54,8 @@ from .services.tournament_unregistration import TournamentUnregistrationService from django.core.exceptions import ValidationError from .forms import ( ProfileUpdateForm, + SimpleCustomUserCreationForm, + SimpleForm ) from .utils.apns import send_push_notification from .utils.licence_validator import LicenseValidator