Laurent 1 year ago
commit cac62289b9
  1. 18
      tournaments/migrations/0089_alter_playerregistration_licence_id.py
  2. 2
      tournaments/models/player_registration.py
  3. 12
      tournaments/models/tournament.py

@ -0,0 +1,18 @@
# Generated by Django 4.2.11 on 2024-10-12 14:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tournaments', '0088_groupstage_step'),
]
operations = [
migrations.AlterField(
model_name='playerregistration',
name='licence_id',
field=models.CharField(blank=True, max_length=50, null=True),
),
]

@ -7,7 +7,7 @@ class PlayerRegistration(models.Model):
team_registration = models.ForeignKey(TeamRegistration, on_delete=models.CASCADE) team_registration = models.ForeignKey(TeamRegistration, on_delete=models.CASCADE)
first_name = models.CharField(max_length=50, blank=True) first_name = models.CharField(max_length=50, blank=True)
last_name = models.CharField(max_length=50, blank=True) last_name = models.CharField(max_length=50, blank=True)
licence_id = models.CharField(max_length=20, null=True, blank=True) licence_id = models.CharField(max_length=50, null=True, blank=True)
rank = models.IntegerField(null=True, blank=True) rank = models.IntegerField(null=True, blank=True)
#has_paid = models.BooleanField(default=False) #has_paid = models.BooleanField(default=False)
#unranked = models.BooleanField(default=False) #unranked = models.BooleanField(default=False)

@ -679,11 +679,13 @@ class Tournament(models.Model):
def display_tournament(self): def display_tournament(self):
if self.publish_tournament: if self.publish_tournament:
return True return True
# is_build_and_not_empty = self.is_build_and_not_empty()
is_build_and_not_empty = self.is_build_and_not_empty()
if self.end_date is not None: if self.end_date is not None:
return True return is_build_and_not_empty
if datetime.now().date() >= self.start_date.date(): if datetime.now().date() >= self.start_date.date():
return True return is_build_and_not_empty
minimum_publish_date = self.creation_date.replace(hour=9, minute=0) + timedelta(days=1) minimum_publish_date = self.creation_date.replace(hour=9, minute=0) + timedelta(days=1)
return timezone.now() >= minimum_publish_date return timezone.now() >= minimum_publish_date
@ -784,8 +786,8 @@ class Tournament(models.Model):
def hide_weight(self): def hide_weight(self):
return self.hide_teams_weight return self.hide_teams_weight
# def is_build_and_not_empty(self): def is_build_and_not_empty(self):
# return (len(self.groupstage_set.all()) > 0 or len(self.round_set.all()) > 0) and len(self.teamregistration_set.all()) >= 4 return (len(self.groupstage_set.all()) > 0 or len(self.round_set.all()) > 0) and len(self.teamregistration_set.all()) >= 4
def day_duration_formatted(self): def day_duration_formatted(self):
return plural_format("jour", self.day_duration) return plural_format("jour", self.day_duration)

Loading…
Cancel
Save