Laurent 1 year ago
commit 41c903539b
  1. 18
      tournaments/migrations/0058_match_confirmed_start_date.py
  2. 7
      tournaments/models/match.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),
),
]

@ -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
@ -9,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)
@ -107,7 +109,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):

Loading…
Cancel
Save