From 50dd88aa9d1478c0eea88cef1049abee55cff35f Mon Sep 17 00:00:00 2001 From: Razmig Sarkissian Date: Fri, 28 Apr 2023 20:01:44 +0200 Subject: [PATCH] html and model update --- scores/models.py | 17 +++++++- scores/static/scores/style.css | 6 ++- scores/templates/scores/index.html | 63 ++++++++++++++++++++---------- 3 files changed, 62 insertions(+), 24 deletions(-) diff --git a/scores/models.py b/scores/models.py index 74af909..1a3ded9 100644 --- a/scores/models.py +++ b/scores/models.py @@ -33,6 +33,19 @@ class Match(models.Model): team2scorecolumn4 = models.CharField(max_length=200, blank=True) team2scorecolumn5 = models.CharField(max_length=200, blank=True) + def durationPrefix(self): + + _seconds = 0 + if self.enddate: + _seconds = (self.enddate - self.date).total_seconds() + else: + _seconds = (timezone.now() - self.date).total_seconds() + + if _seconds > 0: + return "Temps de jeu" + else : + return "Démarrage prévu dans" + def duration(self): _seconds = 0 @@ -44,12 +57,12 @@ class Match(models.Model): if _seconds > 0: _hours = int(_seconds / 3600) _minutes = int((_seconds % 3600) / 60) - return f"{_hours}:{_minutes:02d}" + return f"{_hours:02d}:{_minutes:02d} min" else : _seconds = _seconds * -1 _hours = int(_seconds / 3600) _minutes = int((_seconds % 3600) / 60) - return "Démarre dans " + f"{_hours}:{_minutes:02d}" + "..." + return f"{_hours:02d}:{_minutes:02d} min" def seconds(self): return (timezone.now() - self.date).total_seconds() diff --git a/scores/static/scores/style.css b/scores/static/scores/style.css index f53bbcf..ab8aefd 100644 --- a/scores/static/scores/style.css +++ b/scores/static/scores/style.css @@ -2,8 +2,9 @@ html, body { /* font-size: 30px; /* px signifie 'pixels': la taille de base pour la police est désormais 10 pixels de haut */ /* font-family: 'Open Sans', sans-serif; /* cela devrait être le reste du résultat obtenu à partir de Google fonts */ - - font-family: Helvetica, sans-serif; + font-family: -apple-system, BlinkMacSystemFont, monospace; + /*font-family: 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas, monospace;*/ + /*font-family: Helvetica, sans-serif;*/ background-color: #3878D8; color: white; @@ -58,6 +59,7 @@ td { .big { font-size: 30px; + font-weight: 600; } .score { diff --git a/scores/templates/scores/index.html b/scores/templates/scores/index.html index 2f76f38..a8ba009 100644 --- a/scores/templates/scores/index.html +++ b/scores/templates/scores/index.html @@ -46,41 +46,51 @@ document.getElementById("demo").innerHTML = "Démarrage en cours..."; {% endif %}
+ {% autoescape off %}
{% if live_matches %} {% for match in live_matches %}
-

COURS #{{ match.court }}

+

TERRAIN #{{ match.court }}

{{ match.title }}

{% if match.team3 %} - + {% if match.team1scorecolumn1 %}{% endif %} + {% if match.team2scorecolumn1 %}{% endif %} - + {% if match.team1scorecolumn2 %}{% endif %} + {% if match.team2scorecolumn2 %}{% endif %} - + {% if match.team1scorecolumn3 %}{% endif %} + {% if match.team2scorecolumn3 %}{% endif %} - + {% if match.team1scorecolumn4 %}{% endif %} + {% if match.team2scorecolumn4 %}{% endif %} - + {% if match.team5 %} + + {% if match.team1scorecolumn5 %}{% endif %} + {% if match.team2scorecolumn5 %}{% endif %} + {% endif %} +
{{ match.team1 }}
{{ match.team1|linebreaksbr }}{{ match.team1scorecolumn1 }}{{ match.team2scorecolumn1 }}
{{ match.team2 }}
{{ match.team2|linebreaksbr }}{{ match.team1scorecolumn2 }}{{ match.team2scorecolumn2 }}
{{ match.team3 }}
{{ match.team3|linebreaksbr }}{{ match.team1scorecolumn3 }}{{ match.team2scorecolumn3 }}
{{ match.team4 }}
{{ match.team4|linebreaksbr }}{{ match.team1scorecolumn4 }}{{ match.team2scorecolumn4 }}
{{ match.team5 }}
{{ match.team5|linebreaksbr }}{{ match.team1scorecolumn5 }}{{ match.team2scorecolumn5 }}
{% else %} - + {% if match.team1scorecolumn1 %}{% endif %} {% if match.team1scorecolumn2 %}{% endif %} {% if match.team1scorecolumn3 %}{% endif %} @@ -88,7 +98,7 @@ document.getElementById("demo").innerHTML = "Démarrage en cours..."; {% if match.team1scorecolumn5 %}{% endif %} - + {% if match.team2scorecolumn1 %}{% endif %} {% if match.team2scorecolumn2 %}{% endif %} {% if match.team2scorecolumn3 %}{% endif %} @@ -100,8 +110,10 @@ document.getElementById("demo").innerHTML = "Démarrage en cours..."; {% endif %} - -

{{ match.duration }}

+

+

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

{% endfor %} @@ -117,28 +129,37 @@ document.getElementById("demo").innerHTML = "Démarrage en cours..."; {% if match.team3 %}
{{ match.team1 }}{{ match.team1|linebreaksbr }}{{ match.team1scorecolumn1 }}{{ match.team1scorecolumn2 }}{{ match.team1scorecolumn3 }}{{ match.team1scorecolumn5 }}
{{ match.team2 }}{{ match.team2|linebreaksbr }}{{ match.team2scorecolumn1 }}{{ match.team2scorecolumn2 }}{{ match.team2scorecolumn3 }}
- + {% if match.team1scorecolumn1 %}{% endif %} + {% if match.team2scorecolumn1 %}{% endif %} - + {% if match.team1scorecolumn2 %}{% endif %} + {% if match.team2scorecolumn2 %}{% endif %} - + {% if match.team1scorecolumn3 %}{% endif %} + {% if match.team2scorecolumn3 %}{% endif %} - + {% if match.team1scorecolumn4 %}{% endif %} + {% if match.team2scorecolumn4 %}{% endif %} - + {% if match.team5 %} + + {% if match.team1scorecolumn5 %}{% endif %} + {% if match.team2scorecolumn5 %}{% endif %} + {% endif %} +
{{ match.team1 }}
{{ match.team1|linebreaksbr }}{{ match.team1scorecolumn1 }}{{ match.team2scorecolumn1 }}
{{ match.team2 }}
{{ match.team2|linebreaksbr }}{{ match.team1scorecolumn2 }}{{ match.team2scorecolumn2 }}
{{ match.team3 }}
{{ match.team3|linebreaksbr }}{{ match.team1scorecolumn3 }}{{ match.team2scorecolumn3 }}
{{ match.team4 }}
{{ match.team4|linebreaksbr }}{{ match.team1scorecolumn4 }}{{ match.team2scorecolumn4 }}
{{ match.team5 }}
{{ match.team5|linebreaksbr }}{{ match.team1scorecolumn5 }}{{ match.team2scorecolumn5 }}
{% else %} - + {% if match.team1scorecolumn1 %}{% endif %} {% if match.team1scorecolumn2 %}{% endif %} {% if match.team1scorecolumn3 %}{% endif %} @@ -146,7 +167,7 @@ document.getElementById("demo").innerHTML = "Démarrage en cours..."; {% if match.team1scorecolumn5 %}{% endif %} - + {% if match.team2scorecolumn1 %}{% endif %} {% if match.team2scorecolumn2 %}{% endif %} {% if match.team2scorecolumn3 %}{% endif %} @@ -159,8 +180,10 @@ document.getElementById("demo").innerHTML = "Démarrage en cours..."; -

{{ match.duration }}

- +

+

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

{% endfor %} @@ -168,7 +191,7 @@ document.getElementById("demo").innerHTML = "Démarrage en cours..."; - + {% endautoescape %} {% if club.footer %}
{{ match.team1 }}{{ match.team1|linebreaksbr }}{{ match.team1scorecolumn1 }}{{ match.team1scorecolumn2 }}{{ match.team1scorecolumn3 }}{{ match.team1scorecolumn5 }}
{{ match.team2 }}{{ match.team2|linebreaksbr }}{{ match.team2scorecolumn1 }}{{ match.team2scorecolumn2 }}{{ match.team2scorecolumn3 }}