summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--playoff.py18
-rw-r--r--playoff/template.py18
2 files changed, 28 insertions, 8 deletions
diff --git a/playoff.py b/playoff.py
index 0e7cce5..c159402 100644
--- a/playoff.py
+++ b/playoff.py
@@ -28,6 +28,12 @@ def get_shortname(fullname):
return team[1]
return fullname
+def get_team_image(fullname):
+ for team in settings['teams']:
+ if team[0] == fullname and len(team) > 2:
+ return p_temp.LEADERBOARD_ROW_FLAG % (team[2])
+ return ''
+
def get_match_table(match):
rows = ''
for team in match.teams:
@@ -75,10 +81,12 @@ def get_match_grid(grid, matches, width, height):
return p_temp.MATCH_GRID % (width, height, width, height, grid_boxes)
def get_leaderboard_table(leaderboard):
+ if len([t for t in leaderboard if t is not None]) == 0:
+ return ''
position = 1
rows = ''
- for team in [team if team is not None else '' for team in leaderboard]:
- rows += p_temp.LEADERBOARD_ROW % (position, team)
+ for team in leaderboard:
+ rows += p_temp.LEADERBOARD_ROW % (position, get_team_image(team), team or '')
position +=1
html = p_temp.LEADERBOARD.decode('utf8') % (rows)
return html
@@ -112,7 +120,7 @@ def get_match_info(match):
info.loser_matches = list(set(info.loser_matches))
try:
row = db_fetch(match['database'], p_sql.PREFIX, ())
- info.link = '%srunda%d' % (row[0], match['round'])
+ info.link = '%srunda%d.html' % (row[0], match['round'])
except Exception as e:
pass
try:
@@ -166,6 +174,10 @@ for phase in settings['phases']:
match_info[match['id']].link = phase['link'] if match_info[match['id']].link is None else urljoin(phase['link'], match_info[match['id']].link)
grid[-1].append(match['id'])
+for team in settings['teams']:
+ if len(team) > 3:
+ leaderboard[team[3]-1] = team[0]
+
leaderboard_teams = {}
for phase in settings['phases']:
for match in phase['matches']:
diff --git a/playoff/template.py b/playoff/template.py
index 65a846b..5a282e3 100644
--- a/playoff/template.py
+++ b/playoff/template.py
@@ -38,19 +38,21 @@ MATCH_GRID = '''
'''
MATCH_GRID_PHASE = '''
-<a href="%s" target="_top" style="display: inline-block; width: %dpx; text-align: center; position: absolute; top: 0; left: %dpx">%s</a>
+<a href="%s" target="_top" style="display: inline-block; width: %dpx; text-align: center; position: absolute; top: 0; left: %dpx">
+<font size="4">%s</font>
+</a>
'''
-MATCH_GRID_RUNNING_PHASE = '''
+MATCH_GRID_PHASE_RUNNING = '''
<a href="%s" target="_top" style="display: inline-block; width: %dpx; text-align: center; position: absolute; top: 0; left: %dpx">
<img src="images/A.gif" />
-%s
+<font size="4">%s</font>
<img src="images/A.gif" />
</a>
'''
MATCH_BOX = '''
-<div style="position: absolute; left: %dpx; top: %dpx" data-id="%d" data-winner="%s" data-loser="%s" class="playoff_matchbox">
+<div style="text-align: center; position: absolute; left: %dpx; top: %dpx" data-id="%d" data-winner="%s" data-loser="%s" class="playoff_matchbox">
%s
</div>
'''
@@ -74,10 +76,16 @@ LEADERBOARD = '''
LEADERBOARD_ROW = '''
<tr>
<td class="bdc1">%d</td>
-<td class="bd">&nbsp;%s&nbsp;</td>
+<td class="bd">
+&nbsp;%s&nbsp;&nbsp;%s&nbsp;
+</td>
</tr>
'''
+LEADERBOARD_ROW_FLAG = '''
+<img class="fl" src="images/%s" />
+'''
+
PAGE_HEAD = '''
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache" />