From d06a8cea43b992e958c886724f3f502a4d78d16c Mon Sep 17 00:00:00 2001 From: Raz Date: Sat, 12 Oct 2024 16:12:14 +0200 Subject: [PATCH 1/3] licenceid limit to 50 --- tournaments/models/player_registration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tournaments/models/player_registration.py b/tournaments/models/player_registration.py index 6b10736..b35badb 100644 --- a/tournaments/models/player_registration.py +++ b/tournaments/models/player_registration.py @@ -7,7 +7,7 @@ class PlayerRegistration(models.Model): team_registration = models.ForeignKey(TeamRegistration, on_delete=models.CASCADE) first_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) #has_paid = models.BooleanField(default=False) #unranked = models.BooleanField(default=False) From 2878dde82e42faf3f9237554d542fb5edeebd5d3 Mon Sep 17 00:00:00 2001 From: Raz Date: Sat, 12 Oct 2024 16:17:08 +0200 Subject: [PATCH 2/3] licenceid limit to 50 --- ...0089_alter_playerregistration_licence_id.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tournaments/migrations/0089_alter_playerregistration_licence_id.py diff --git a/tournaments/migrations/0089_alter_playerregistration_licence_id.py b/tournaments/migrations/0089_alter_playerregistration_licence_id.py new file mode 100644 index 0000000..4412e4d --- /dev/null +++ b/tournaments/migrations/0089_alter_playerregistration_licence_id.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), + ), + ] From fb1494e7429aaf65a6c93e74871325be9a9b7bfc Mon Sep 17 00:00:00 2001 From: Raz Date: Sat, 12 Oct 2024 17:06:13 +0200 Subject: [PATCH 3/3] hide empty tournaments when running --- tournaments/models/tournament.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index 1a0d3a5..d606af4 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -679,11 +679,13 @@ class Tournament(models.Model): def display_tournament(self): if self.publish_tournament: 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: - return True + return is_build_and_not_empty 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) return timezone.now() >= minimum_publish_date @@ -784,8 +786,8 @@ class Tournament(models.Model): def hide_weight(self): return self.hide_teams_weight - # 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 + 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 def day_duration_formatted(self): return plural_format("jour", self.day_duration)