summaryrefslogtreecommitdiff
path: root/jfr_playoff/generator.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2018-10-01 16:09:07 +0200
committeremkael <emkael@tlen.pl>2018-10-01 16:09:07 +0200
commit03ab8b041179daa2ed75966a3c2255e239f8fde7 (patch)
tree2f81c45931ddce766dd91eeacb36e1f054585236 /jfr_playoff/generator.py
parent6f147d1b37de5c12b77c51ca2f80031cbec6ae20 (diff)
Explicitly counting known teams for match boxes
Diffstat (limited to 'jfr_playoff/generator.py')
-rw-r--r--jfr_playoff/generator.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/jfr_playoff/generator.py b/jfr_playoff/generator.py
index a1b519e..f2a2c55 100644
--- a/jfr_playoff/generator.py
+++ b/jfr_playoff/generator.py
@@ -1,5 +1,6 @@
from datetime import datetime
+from jfr_playoff.dto import coalesce
from jfr_playoff.template import PlayoffTemplate
from jfr_playoff.data import PlayoffData
from jfr_playoff.logger import PlayoffLogger
@@ -54,9 +55,11 @@ class PlayoffGenerator(object):
rows = ''
for team in match.teams:
score_html = self.p_temp.get('MATCH_SCORE', team.score)
+ teams = [coalesce(name, '??') for name in team.name]
team_label = ' / '.join([
- self.data.get_shortname(name) for name in team.name])
- team_name = '<br />'.join(team.name)
+ self.data.get_shortname(name) if name is not None else '??' for name in team.name]) \
+ if team.known_teams > 0 else ''
+ team_name = '<br />'.join(teams)
label_max_length = self.page.get('label_length_limit', 0)
if label_max_length:
team_label = team_label[:label_max_length] + (team_label[label_max_length:] and '(...)')
@@ -70,8 +73,8 @@ class PlayoffGenerator(object):
rows += self.p_temp.get(
'MATCH_TEAM_ROW',
' '.join([
- 'winner' if match.winner in team.name else '',
- 'loser' if match.loser in team.name else ''
+ 'winner' if match.winner in teams else '',
+ 'loser' if match.loser in teams else ''
]).strip(),
team_html,
self.p_temp.get(