From 875613290c623360d24cadc60ca5bb62730afc4f Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Wed, 29 May 2024 10:47:37 +0200 Subject: [PATCH 1/2] display groupstage match even if no start date --- tournaments/models/match.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tournaments/models/match.py b/tournaments/models/match.py index acf21fa..8b5e928 100644 --- a/tournaments/models/match.py +++ b/tournaments/models/match.py @@ -1,4 +1,5 @@ from django.db import models +from tournaments.models import group_stage from . import Round, GroupStage, FederalMatchCategory from django.utils import timezone, formats import uuid @@ -107,7 +108,10 @@ class Match(models.Model): return False def should_appear(self): - return (self.start_date or self.end_date) and len(self.team_scores.all()) > 0 + if self.group_stage is None: + return (self.start_date or self.end_date) and len(self.team_scores.all()) > 0 + else: + return len(self.team_scores.all()) > 0 def formatted_duration(self): From f1ef9def042b02622d9b89b7b8fac45dd15a18d8 Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Wed, 29 May 2024 10:51:16 +0200 Subject: [PATCH 2/2] add confirmed start date --- .../0058_match_confirmed_start_date.py | 18 ++++++++++++++++++ tournaments/models/match.py | 1 + 2 files changed, 19 insertions(+) create mode 100644 tournaments/migrations/0058_match_confirmed_start_date.py diff --git a/tournaments/migrations/0058_match_confirmed_start_date.py b/tournaments/migrations/0058_match_confirmed_start_date.py new file mode 100644 index 0000000..45267dc --- /dev/null +++ b/tournaments/migrations/0058_match_confirmed_start_date.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.11 on 2024-05-29 08:49 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('tournaments', '0057_tournament_hide_teams_weight'), + ] + + operations = [ + migrations.AddField( + model_name='match', + name='confirmed_start_date', + field=models.DateTimeField(blank=True, null=True), + ), + ] diff --git a/tournaments/models/match.py b/tournaments/models/match.py index 8b5e928..8bda914 100644 --- a/tournaments/models/match.py +++ b/tournaments/models/match.py @@ -10,6 +10,7 @@ class Match(models.Model): group_stage = models.ForeignKey(GroupStage, null=True, blank=True, on_delete=models.CASCADE) name = models.CharField(max_length=200, null=True, blank=True) start_date = models.DateTimeField(null=True, blank=True) + confirmed_start_date = models.DateTimeField(null=True, blank=True) end_date = models.DateTimeField(null=True, blank=True) index = models.IntegerField(default=0) #order = models.IntegerField(default=0)