diff options
author | emkael <emkael@tlen.pl> | 2017-02-22 14:40:52 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2017-02-22 14:40:52 +0100 |
commit | ef06b88555ee46c9dd199f83dce731d8a7b039a6 (patch) | |
tree | 2ac61237d635ff5e3eb2f2d5c71449ed537d804e /playoff.py | |
parent | f118c0f3704fa07a33543ee2aa018f16ac993b5a (diff) |
Fetching prefixes for match links
Diffstat (limited to 'playoff.py')
-rw-r--r-- | playoff.py | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -1,6 +1,7 @@ import json, os, shutil, sys import mysql.connector from datetime import datetime +from urlparse import urljoin from playoff import sql as p_sql from playoff import template as p_temp @@ -31,8 +32,10 @@ def get_match_table(match): rows = '' for team in match.teams: rows += p_temp.MATCH_TEAM_ROW % ( + match.link, team.name, ' / '.join([get_shortname(name) for name in team.name.split('<br />')]), + match.link, team.score ) html = p_temp.MATCH_TABLE.decode('utf8') % ( @@ -87,7 +90,7 @@ class Team: class Match: teams = None running = 0 - link = '#' + link = None winner = None loser = None winner_matches = None @@ -108,6 +111,11 @@ def get_match_info(match): info.winner_matches = list(set(info.winner_matches)) 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']) + except Exception as e: + pass + try: row = db_fetch(match['database'], p_sql.MATCH_RESULTS, (match['table'], match['round'])) info.teams[0].name = row[0] info.teams[1].name = row[1] @@ -155,7 +163,7 @@ for phase in settings['phases']: grid.append([]) for match in phase['matches']: match_info[match['id']] = get_match_info(match) - match_info[match['id']].link = phase['link'] + 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']) leaderboard_teams = {} |