From 65677db2a9517008485c5f1cf275f5b88227934a Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Mon, 31 Jul 2023 11:40:34 +0200 Subject: [PATCH] add walkout info --- scores/migrations/0020_match_haswalkoutteam.py | 18 ++++++++++++++++++ scores/models.py | 1 + scores/serializers.py | 2 +- scores/templates/scores/index.html | 2 +- scores/templates/scores/tournament.html | 2 +- 5 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 scores/migrations/0020_match_haswalkoutteam.py diff --git a/scores/migrations/0020_match_haswalkoutteam.py b/scores/migrations/0020_match_haswalkoutteam.py new file mode 100644 index 0000000..c074763 --- /dev/null +++ b/scores/migrations/0020_match_haswalkoutteam.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2 on 2023-07-31 09:34 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('scores', '0019_remove_team_match_team_tournament'), + ] + + operations = [ + migrations.AddField( + model_name='match', + name='hasWalkOutTeam', + field=models.BooleanField(default=False), + ), + ] diff --git a/scores/models.py b/scores/models.py index 6d80ed8..64346bb 100644 --- a/scores/models.py +++ b/scores/models.py @@ -35,6 +35,7 @@ class Match(models.Model): court = models.IntegerField(default=0) match_index = models.IntegerField(default=0) refreshrate = models.IntegerField(default=10) + hasWalkOutTeam = models.BooleanField(default=False) title = models.CharField(max_length=200, blank=True) team1 = models.CharField(max_length=200, blank=True) diff --git a/scores/serializers.py b/scores/serializers.py index f4c803c..6feaff4 100644 --- a/scores/serializers.py +++ b/scores/serializers.py @@ -21,7 +21,7 @@ class TournamentSerializer(serializers.HyperlinkedModelSerializer): class MatchSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Match - fields = ['id', 'court', 'match_index', 'tournament', 'date', 'enddate', 'title', 'refreshrate', 'team1', 'team2', 'team3', 'team4', 'team5', + fields = ['id', 'court', 'match_index', 'tournament', 'date', 'enddate', 'title', 'refreshrate', 'team1', 'team2', 'team3', 'team4', 'team5', 'hasWalkOutTeam', 'team1scorecolumn1', 'team1scorecolumn2', 'team1scorecolumn3', 'team1scorecolumn4', 'team1scorecolumn5', 'team2scorecolumn1', 'team2scorecolumn2', 'team2scorecolumn3', 'team2scorecolumn4', 'team2scorecolumn5'] diff --git a/scores/templates/scores/index.html b/scores/templates/scores/index.html index 2b782bd..de1523c 100644 --- a/scores/templates/scores/index.html +++ b/scores/templates/scores/index.html @@ -239,7 +239,7 @@ {% endif %} - {% if match.isMatch or match.isBracket %} + {% if not match.isStatistic and not match.hasWalkOutTeam %}

{{ match.durationPrefix }}
{{ match.duration }}
diff --git a/scores/templates/scores/tournament.html b/scores/templates/scores/tournament.html index f87cec5..44bdf9c 100644 --- a/scores/templates/scores/tournament.html +++ b/scores/templates/scores/tournament.html @@ -216,7 +216,7 @@ {% endif %} - {% if not match.isStatistic %} + {% if not match.isStatistic and not match.hasWalkOutTeam %}

{{ match.durationPrefix }}
{{ match.duration }}