Merge remote-tracking branch 'origin/main' into online_registration

online_registration
Raz 12 months ago
commit 400885627b
  1. 58
      tournaments/migrations/0094_alter_customuser_bracket_match_format_preference_and_more.py
  2. 4
      tournaments/models/enums.py
  3. 4
      tournaments/models/team_registration.py
  4. 16
      tournaments/models/tournament.py

@ -0,0 +1,58 @@
# Generated by Django 4.2.11 on 2024-11-18 08:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tournaments', '0093_drawlog_draw_type_and_more'),
]
operations = [
migrations.AlterField(
model_name='customuser',
name='bracket_match_format_preference',
field=models.IntegerField(blank=True, choices=[(0, 'Two sets'), (1, 'Two sets super tie'), (2, 'Two sets of four games'), (3, 'Nine games'), (4, 'Super Tie-Break'), (5, 'Mega Tie-Break'), (6, 'Two Sets with decisive point'), (7, 'Two Sets with decisive point and super tie-break'), (8, 'Two sets of four games with decisive point'), (9, 'Nine games with decisive point'), (10, 'Two sets of Super Tie-Break decisive point'), (11, 'Single set'), (12, 'Single set with decisive point'), (13, 'Single set of four games'), (14, 'Single set of four games with decisive point')], default=3, null=True),
),
migrations.AlterField(
model_name='customuser',
name='group_stage_match_format_preference',
field=models.IntegerField(blank=True, choices=[(0, 'Two sets'), (1, 'Two sets super tie'), (2, 'Two sets of four games'), (3, 'Nine games'), (4, 'Super Tie-Break'), (5, 'Mega Tie-Break'), (6, 'Two Sets with decisive point'), (7, 'Two Sets with decisive point and super tie-break'), (8, 'Two sets of four games with decisive point'), (9, 'Nine games with decisive point'), (10, 'Two sets of Super Tie-Break decisive point'), (11, 'Single set'), (12, 'Single set with decisive point'), (13, 'Single set of four games'), (14, 'Single set of four games with decisive point')], default=3, null=True),
),
migrations.AlterField(
model_name='customuser',
name='loser_bracket_match_format_preference',
field=models.IntegerField(blank=True, choices=[(0, 'Two sets'), (1, 'Two sets super tie'), (2, 'Two sets of four games'), (3, 'Nine games'), (4, 'Super Tie-Break'), (5, 'Mega Tie-Break'), (6, 'Two Sets with decisive point'), (7, 'Two Sets with decisive point and super tie-break'), (8, 'Two sets of four games with decisive point'), (9, 'Nine games with decisive point'), (10, 'Two sets of Super Tie-Break decisive point'), (11, 'Single set'), (12, 'Single set with decisive point'), (13, 'Single set of four games'), (14, 'Single set of four games with decisive point')], default=3, null=True),
),
migrations.AlterField(
model_name='groupstage',
name='format',
field=models.IntegerField(blank=True, choices=[(0, 'Two sets'), (1, 'Two sets super tie'), (2, 'Two sets of four games'), (3, 'Nine games'), (4, 'Super Tie-Break'), (5, 'Mega Tie-Break'), (6, 'Two Sets with decisive point'), (7, 'Two Sets with decisive point and super tie-break'), (8, 'Two sets of four games with decisive point'), (9, 'Nine games with decisive point'), (10, 'Two sets of Super Tie-Break decisive point'), (11, 'Single set'), (12, 'Single set with decisive point'), (13, 'Single set of four games'), (14, 'Single set of four games with decisive point')], default=3, null=True),
),
migrations.AlterField(
model_name='match',
name='format',
field=models.IntegerField(blank=True, choices=[(0, 'Two sets'), (1, 'Two sets super tie'), (2, 'Two sets of four games'), (3, 'Nine games'), (4, 'Super Tie-Break'), (5, 'Mega Tie-Break'), (6, 'Two Sets with decisive point'), (7, 'Two Sets with decisive point and super tie-break'), (8, 'Two sets of four games with decisive point'), (9, 'Nine games with decisive point'), (10, 'Two sets of Super Tie-Break decisive point'), (11, 'Single set'), (12, 'Single set with decisive point'), (13, 'Single set of four games'), (14, 'Single set of four games with decisive point')], default=3, null=True),
),
migrations.AlterField(
model_name='round',
name='format',
field=models.IntegerField(blank=True, choices=[(0, 'Two sets'), (1, 'Two sets super tie'), (2, 'Two sets of four games'), (3, 'Nine games'), (4, 'Super Tie-Break'), (5, 'Mega Tie-Break'), (6, 'Two Sets with decisive point'), (7, 'Two Sets with decisive point and super tie-break'), (8, 'Two sets of four games with decisive point'), (9, 'Nine games with decisive point'), (10, 'Two sets of Super Tie-Break decisive point'), (11, 'Single set'), (12, 'Single set with decisive point'), (13, 'Single set of four games'), (14, 'Single set of four games with decisive point')], default=3, null=True),
),
migrations.AlterField(
model_name='tournament',
name='group_stage_format',
field=models.IntegerField(blank=True, choices=[(0, 'Two sets'), (1, 'Two sets super tie'), (2, 'Two sets of four games'), (3, 'Nine games'), (4, 'Super Tie-Break'), (5, 'Mega Tie-Break'), (6, 'Two Sets with decisive point'), (7, 'Two Sets with decisive point and super tie-break'), (8, 'Two sets of four games with decisive point'), (9, 'Nine games with decisive point'), (10, 'Two sets of Super Tie-Break decisive point'), (11, 'Single set'), (12, 'Single set with decisive point'), (13, 'Single set of four games'), (14, 'Single set of four games with decisive point')], default=3, null=True),
),
migrations.AlterField(
model_name='tournament',
name='loser_round_format',
field=models.IntegerField(blank=True, choices=[(0, 'Two sets'), (1, 'Two sets super tie'), (2, 'Two sets of four games'), (3, 'Nine games'), (4, 'Super Tie-Break'), (5, 'Mega Tie-Break'), (6, 'Two Sets with decisive point'), (7, 'Two Sets with decisive point and super tie-break'), (8, 'Two sets of four games with decisive point'), (9, 'Nine games with decisive point'), (10, 'Two sets of Super Tie-Break decisive point'), (11, 'Single set'), (12, 'Single set with decisive point'), (13, 'Single set of four games'), (14, 'Single set of four games with decisive point')], default=3, null=True),
),
migrations.AlterField(
model_name='tournament',
name='round_format',
field=models.IntegerField(blank=True, choices=[(0, 'Two sets'), (1, 'Two sets super tie'), (2, 'Two sets of four games'), (3, 'Nine games'), (4, 'Super Tie-Break'), (5, 'Mega Tie-Break'), (6, 'Two Sets with decisive point'), (7, 'Two Sets with decisive point and super tie-break'), (8, 'Two sets of four games with decisive point'), (9, 'Nine games with decisive point'), (10, 'Two sets of Super Tie-Break decisive point'), (11, 'Single set'), (12, 'Single set with decisive point'), (13, 'Single set of four games'), (14, 'Single set of four games with decisive point')], default=3, null=True),
),
]

@ -47,6 +47,8 @@ class FederalMatchCategory(models.IntegerChoices):
TWO_SETS_OF_SUPER_TIE = 10, 'Two sets of Super Tie-Break decisive point'
SINGLE_SET = 11, 'Single set'
SINGLE_SET_DECISIVE_POINT = 12, 'Single set with decisive point'
SINGLE_SET_OF_FOUR_GAMES = 13, 'Single set of four games'
SINGLE_SET_OF_FOUR_GAMES_DECISIVE_POINT = 14, 'Single set of four games with decisive point'
def last_set_is_tie_break(value):
if value == FederalMatchCategory.TWO_SETS_FOUR_GAME or value == FederalMatchCategory.TWO_SETS_FOUR_GAME_DECISIVE_POINT or value == FederalMatchCategory.TWO_SETS_SUPER_TIE or value == FederalMatchCategory.SUPER_TIE or value == FederalMatchCategory.MEGA_TIE or value == FederalMatchCategory.TWO_SETS_DECISIVE_POINT_SUPER_TIE:
@ -55,7 +57,7 @@ class FederalMatchCategory(models.IntegerChoices):
return False
def max_number_of_sets(value):
if value == FederalMatchCategory.SUPER_TIE or value == FederalMatchCategory.MEGA_TIE or value == FederalMatchCategory.NINE_GAMES or value == FederalMatchCategory.NINE_GAMES_DECISIVE_POINT or value == FederalMatchCategory.SINGLE_SET or value == FederalMatchCategory.SINGLE_SET_DECISIVE_POINT:
if value == FederalMatchCategory.SUPER_TIE or value == FederalMatchCategory.MEGA_TIE or value == FederalMatchCategory.NINE_GAMES or value == FederalMatchCategory.NINE_GAMES_DECISIVE_POINT or value == FederalMatchCategory.SINGLE_SET or value == FederalMatchCategory.SINGLE_SET_DECISIVE_POINT or value == FederalMatchCategory.SINGLE_SET_OF_FOUR_GAMES or value == FederalMatchCategory.SINGLE_SET_OF_FOUR_GAMES_DECISIVE_POINT:
return 1
else:
return 3

@ -100,7 +100,7 @@ class TeamRegistration(models.Model):
self.save() # Save the updated weight if necessary
def is_valid_for_summon(self):
return len(self.playerregistration_set.all()) > 0
return len(self.playerregistration_set.all()) > 0 or self.name is not None
def initial_weight(self):
if self.locked_weight is None:
@ -113,5 +113,5 @@ class TeamRegistration(models.Model):
if self.call_date:
return self.call_date.astimezone(timezone)
else:
print("no date")
# print("no date")
return None

@ -803,14 +803,14 @@ class Tournament(models.Model):
group_stage_start_date = self.group_stage_start_date()
if group_stage_start_date is not None:
if bracket_start_date < group_stage_start_date:
return False
return timezone.now() >=first_match_start_date
if timezone.now() >= bracket_start_date:
return True
return False
def bracket_matches(self):
matches = []
for round in self.round_set.all():
@ -837,11 +837,11 @@ class Tournament(models.Model):
start = timezoned_datetime.replace(hour=0, minute=0)
print(f"timezoned_datetime: {timezoned_datetime}")
print(f"tournament end date: {end}")
print(f"current time: {now}")
print(f"tournament start: {start}")
print(f"start <= now <= end: {start <= now <= end}")
# print(f"timezoned_datetime: {timezoned_datetime}")
# print(f"tournament end date: {end}")
# print(f"current time: {now}")
# print(f"tournament start: {start}")
# print(f"start <= now <= end: {start <= now <= end}")
return start <= now <= end
@ -920,7 +920,7 @@ class TeamSummon:
class TeamItem:
def __init__(self, team_registration):
self.names = team_registration.team_names
self.names = team_registration.team_names()
self.date = team_registration.local_call_date()
self.weight = team_registration.weight
self.initial_weight = team_registration.initial_weight()

Loading…
Cancel
Save