@ -96,6 +96,8 @@ class Tournament(BaseModel):
club_member_fee_deduction = models . FloatField ( null = True , blank = True )
unregister_delta_in_hours = models . IntegerField ( default = 24 )
currency_code = models . CharField ( null = True , blank = True , max_length = 3 , default = ' EUR ' )
parent = models . ForeignKey ( ' self ' , blank = True , null = True , on_delete = models . SET_NULL , related_name = ' children ' )
loser_index = models . IntegerField ( default = 0 )
def delete_dependencies ( self ) :
for team_registration in self . team_registrations . all ( ) :
@ -232,7 +234,7 @@ class Tournament(BaseModel):
case AnimationType . CONSOLATION_BRACKET :
return " Consolante "
case AnimationType . CUSTOM :
return " Spécial "
return " Soirée "
case _ :
return " Anim. "
if self . federal_level_category == 1 :
@ -302,8 +304,19 @@ class Tournament(BaseModel):
def get_tournament_status ( self ) :
return self . get_online_registration_status ( ) . status_localized ( )
def get_tournament_status_team_count ( self ) :
def is_team_tournament ( self ) :
return self . minimum_player_per_team > = 2
def get_tournament_status_registration_count ( self ) :
active_teams_count = self . team_registrations . filter ( walk_out = False ) . count ( )
if self . is_team_tournament ( ) is False :
# Count players instead of teams when minimum players per team is under 2
PlayerRegistration = apps . get_model ( ' tournaments ' , ' PlayerRegistration ' )
active_players_count = PlayerRegistration . objects . filter (
team_registration__tournament = self ,
team_registration__walk_out = False
) . count ( )
return active_players_count
return min ( active_teams_count , self . team_count )
def name_and_event ( self ) :