bracket-feature
laurent 12 months ago
commit 3bb78f4077
  1. 58
      tournaments/migrations/0094_alter_customuser_bracket_match_format_preference_and_more.py
  2. 4
      tournaments/models/enums.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

Loading…
Cancel
Save