little fixes

main
Razmig Sarkissian 2 years ago
parent ab1d9c9d89
commit 7464e46b48
  1. 2
      scores/models.py
  2. 7
      scores/static/scores/style.css
  3. 67
      scores/templates/scores/index.html
  4. 37
      scores/templates/scores/match.html
  5. 20
      scores/templates/scores/tournament.html
  6. 2
      scores/urls.py
  7. 12
      scores/views.py

@ -64,7 +64,7 @@ class Match(models.Model):
return self.court / 100
def isMatch(self):
if self.court < 100 and self.court > 0:
if self.court < 100 and self.court >= 0:
return True
else :
return False

@ -83,6 +83,13 @@ td {
vertical-align: middle;
}
.bigscore {
width: 100px;
font-size: 200%;
text-align: center;
vertical-align: middle;
}
.center {
text-align: center;
margin: 0 auto;

@ -15,35 +15,43 @@
<link rel="stylesheet" href="{% static 'scores/style.css' %}">
<title>Padel</title>
{% if not tv %}
<meta http-equiv="refresh" content="15"/>
{% endif %}
</head>
<div class="wrapper">
{% if live_matches.count|add:ended_matches.count > 6 and auto_scrolling and tv %}
{% if tv %}
<script>
var iInterval = 2000;
var iInterval = 4000;
var iScrollInterval = 10000;
var iFadeInterval = 500;
var iScroll = $(document).height() - $(window).height();
var fade = function() {
$("body").fadeOut(iFadeInterval, function(){
$("html, body").scrollTop(0);
$("body").fadeIn(iFadeInterval,function(){
setTimeout(loop, iInterval);
});
});
if (iScroll * 10 + 4000 < 15000) {
iScrollInterval = 10000;
} else {
iScrollInterval = iScroll * 10;
}
var loop = function() {
var iScroll = $(document).height() - $(window).height();
if (iScroll * 10 + 4000 < 15000) {
iScrollInterval = 10000;
} else {
iScrollInterval = iScroll * 10;
}
$("html, body").animate({
scrollTop: iScroll
}, {
duration : iScrollInterval,
easing : "linear",
complete : function() {
setTimeout(fade, iInterval);
setTimeout(function(){
$(window).scrollTop(0);
window.location.reload();
}, iInterval);
}
});
};
@ -59,20 +67,28 @@
{% autoescape off %}
<div class="container">
{% if live_matches %}
{% for match in live_matches %}
{% if match.isMatch %}
<div class="match">
<div style="width: 100%;">
<div style="float: left;">
<h3>{{ match.title }}</h3>
{% if tv %}
<h3>{{ match.title|default:"Match" }} | <a href="/tv/club/{{ match.tournament.club.name }}/tournoi/{{ match.tournament.id }}">{{match.tournament.name}}</a>
{% else %}
<h3>{{ match.title|default:"Match" }} | <a href="/club/{{ match.tournament.club.name }}/tournoi/{{ match.tournament.id }}">{{match.tournament.name}}</a>
{% endif %}
</div>
{% if match.isMatch or match.isBracket %}
{% if match.isMatch %}
{% if match.isMatch and match.court > 0 %}
<div style="float: right;">
{% if tv %}
<h3><a href="/tv/match/{{ match.id }}/">TERRAIN #{{ match.court }}</a><h3>
{% else %}
<h3><a href="/match/{{ match.id }}/">TERRAIN #{{ match.court }}</a><h3>
{% endif %}
</div>
{% else %}
{% elif match.court > 0 %}
<div style="float: right;">
<h3><a href="/match/{{ match.id }}/">POULE #{{ match.poule|floatformat:0 }}</a><h3>
</div>
@ -145,7 +161,7 @@
{% endif %}
<!-- <p id="demo"></p> -->
{% if match.isMatch or match.isBracket %}
{% if not match.isStatistic %}
<p class="duration">
<div class="small"> {{ match.durationPrefix }}</div>
<div class="big">{{ match.duration }}</div>
@ -153,24 +169,27 @@
{% endif %}
</div>
{% endfor %}
{% endif %}
{% endfor %}
{% if ended_matches %}
{% for match in ended_matches %}
{% if match.isMatch %}
<div class="match">
<div style="width: 100%;">
<div style="float: left;">
<h3>{{ match.title }}</h3>
<h3>{{ match.title|default:"Match" }}</h3>
</div>
{% if match.isMatch or match.isBracket %}
{% if match.isMatch %}
{% if match.isMatch and match.court > 0 %}
<div style="float: right;">
{% if tv %}
<h3><a href="/tv/match/{{ match.id }}/">TERRAIN #{{ match.court }}</a><h3>
{% else %}
<h3><a href="/match/{{ match.id }}/">TERRAIN #{{ match.court }}</a><h3>
{% endif %}
</div>
{% else %}
{% elif match.court > 0 %}
<div style="float: right;">
<h3><a href="/match/{{ match.id }}/">POULE #{{ match.poule|floatformat:0 }}</a><h3>
</div>
@ -247,13 +266,9 @@
<div class="big">{{ match.duration }}</div>
</p>
{% endif %}
<div class="clear" />
</div>
{% endfor %}
{% endif %}
{% endfor %}
</div>
{% endautoescape %}

@ -5,21 +5,32 @@
<head>
<link rel="stylesheet" href="{% static 'scores/style.css' %}">
<title>Padel</title>
{% if tv %}
<meta http-equiv="refresh" content='5'/>
{% else %}
<meta http-equiv="refresh" content='{{ match.refreshrate }}'/>
{% endif %}
</head>
{% if tv %}
<div class="wrapper" style="zoom:200%">
{% else %}
<div class="wrapper">
{% endif %}
{% if match.tournament.club.header %}
<header class="scenter">{{ match.tournament.club.header }}</header>
{% if tv %}
<header class="scenter"><a href="/tv/club/{{ match.tournament.club.name }}/">{{ match.tournament.club.header }}</a></header>
{% else %}
<header class="scenter"><a href="/club/{{ match.tournament.club.name }}/">{{ match.tournament.club.header }}</a></header>
{% endif %}
{% endif %}
<main class="page-body">
{% autoescape off %}
<div class="scenter">{{ match.tournament.name }}</div>
{% if tv %}
<div class="scenter"><a href="/tv/club/{{ match.tournament.club.name }}/tournoi/{{ match.tournament.id }}">{{match.tournament.name}}</a></div>
{% else %}
<div class="scenter"><a href="/club/{{ match.tournament.club.name }}/tournoi/{{ match.tournament.id }}">{{match.tournament.name}}</a></div>
{% endif %}
<div class="scontainer">
<div class="smatch">
@ -59,19 +70,19 @@
<table>
<tr>
<td class="steamname">{{ match.team1|linebreaksbr }}</td>
{% if match.team1scorecolumn1 %}<td class="score">{{ match.team1scorecolumn1 }}</td>{% endif %}
{% if match.team1scorecolumn2 %}<td class="score">{{ match.team1scorecolumn2 }}</td>{% endif %}
{% if match.team1scorecolumn3 %}<td class="score">{{ match.team1scorecolumn3 }}</td>{% endif %}
{% if match.team1scorecolumn4 %}<td class="score">{{ match.team1scorecolumn4 }}</td>{% endif %}
{% if match.team1scorecolumn5 %}<td class="score">{{ match.team1scorecolumn5 }}</td>{% endif %}
{% if match.team1scorecolumn1 %}<td class="bigscore">{{ match.team1scorecolumn1 }}</td>{% endif %}
{% if match.team1scorecolumn2 %}<td class="bigscore">{{ match.team1scorecolumn2 }}</td>{% endif %}
{% if match.team1scorecolumn3 %}<td class="bigscore">{{ match.team1scorecolumn3 }}</td>{% endif %}
{% if match.team1scorecolumn4 %}<td class="bigscore">{{ match.team1scorecolumn4 }}</td>{% endif %}
{% if match.team1scorecolumn5 %}<td class="bigscore">{{ match.team1scorecolumn5 }}</td>{% endif %}
</tr>
<tr>
<td class="steamname">{{ match.team2|linebreaksbr }}</td>
{% if match.team2scorecolumn1 %}<td class="score">{{ match.team2scorecolumn1 }}</td>{% endif %}
{% if match.team2scorecolumn2 %}<td class="score">{{ match.team2scorecolumn2 }}</td>{% endif %}
{% if match.team2scorecolumn3 %}<td class="score">{{ match.team2scorecolumn3 }}</td>{% endif %}
{% if match.team2scorecolumn4 %}<td class="score">{{ match.team2scorecolumn4 }}</td>{% endif %}
{% if match.team2scorecolumn5 %}<td class="score">{{ match.team2scorecolumn5 }}</td>{% endif %}
{% if match.team2scorecolumn1 %}<td class="bigscore">{{ match.team2scorecolumn1 }}</td>{% endif %}
{% if match.team2scorecolumn2 %}<td class="bigscore">{{ match.team2scorecolumn2 }}</td>{% endif %}
{% if match.team2scorecolumn3 %}<td class="bigscore">{{ match.team2scorecolumn3 }}</td>{% endif %}
{% if match.team2scorecolumn4 %}<td class="bigscore">{{ match.team2scorecolumn4 }}</td>{% endif %}
{% if match.team2scorecolumn5 %}<td class="bigscore">{{ match.team2scorecolumn5 }}</td>{% endif %}
</tr>
</table>

@ -82,18 +82,22 @@
</div>
</div>
{% for match in live_matches %}
{% if not match.isBracket %}
{% if match.isMatch %}
<div class="match">
<div style="width: 100%;">
<div style="float: left;">
<h3>{{ match.title|default:"Match" }}</h3>
</div>
{% if match.isMatch or match.isBracket %}
{% if match.isMatch %}
{% if match.isMatch and match.court > 0 %}
<div style="float: right;">
{% if tv %}
<h3><a href="/tv/match/{{ match.id }}/">TERRAIN #{{ match.court }}</a><h3>
{% else %}
<h3><a href="/match/{{ match.id }}/">TERRAIN #{{ match.court }}</a><h3>
{% endif %}
</div>
{% else %}
{% elif match.court > 0 %}
<div style="float: right;">
<h3><a href="/match/{{ match.id }}/">POULE #{{ match.poule|floatformat:0 }}</a><h3>
</div>
@ -172,7 +176,7 @@
{% endfor %}
{% for match in ended_matches %}
{% if not match.isBracket %}
{% if match.isMatch %}
<div class="match">
<div style="width: 100%;">
@ -180,11 +184,15 @@
<h3>{{ match.title|default:"Match" }}</h3>
</div>
{% if match.isMatch or match.isBracket %}
{% if match.isMatch %}
{% if match.isMatch and match.court > 0 %}
<div style="float: right;">
{% if tv %}
<h3><a href="/tv/match/{{ match.id }}/">TERRAIN #{{ match.court }}</a><h3>
{% else %}
<h3><a href="/match/{{ match.id }}/">TERRAIN #{{ match.court }}</a><h3>
{% endif %}
</div>
{% else %}
{% elif match.court > 0 %}
<div style="float: right;">
<h3><a href="/match/{{ match.id }}/">POULE #{{ match.poule|floatformat:0 }}</a><h3>
</div>

@ -38,7 +38,7 @@ urlpatterns = [
path('tv/tournoi/<str:tournament_shortname>/equipes/', views.tv_teams_tournament_name, name='teams'),
path('tv/club/<str:club_name>/<str:tournament_shortname>/equipes/', views.tv_teams_club_name_tournament_name, name='teams'),
path('tv/', views.index, name='index'),
path('tv/', views.tv_index, name='index'),
path('tv/tournoi/<str:tournament_shortname>/', views.tv_tournament_name, name='tournament'),
path('tv/club/<str:club_name>/', views.tv_club_name, name='club'),
path('tv/club/<str:club_name>/tournoi/<int:tournament_id>/', views.tv_club_name_tournament, name='tournament'),

@ -19,6 +19,18 @@ def index(request):
}
return HttpResponse(template.render(context, request))
def tv_index(request):
club = Club.objects.first()
live_matches = Match.objects.filter(enddate__isnull=True).order_by('court')
ended_matches = Match.objects.filter(enddate__isnull=False).order_by('court')
template = loader.get_template('scores/index.html')
context = {
'club': club,
'tv': True,
'live_matches': live_matches,
'ended_matches': ended_matches,
}
return HttpResponse(template.render(context, request))
def club(request, club_id):

Loading…
Cancel
Save