fix register tournament

sync_v2
Raz 7 months ago
parent cd661743b8
commit eb05fcb9b1
  1. 1
      tournaments/repositories.py
  2. 9
      tournaments/services/tournament_registration.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

@ -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():

Loading…
Cancel
Save