From 8a29e0818606032bdecdf794e644dbb55d5f09b5 Mon Sep 17 00:00:00 2001 From: emkael Date: Fri, 6 Jul 2018 01:15:34 +0200 Subject: Generating connector info between matches and starting positions --- jfr_playoff/generator.py | 27 +++++++++++++++++++++------ jfr_playoff/template.py | 2 +- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/jfr_playoff/generator.py b/jfr_playoff/generator.py index a42130a..9b7f31e 100644 --- a/jfr_playoff/generator.py +++ b/jfr_playoff/generator.py @@ -106,16 +106,31 @@ class PlayoffGenerator(object): def get_match_box(self, match, position): if match is not None: + winner_link = [ + str(m) for m in match.winner_matches + ] if match.winner_matches is not None else [] + loser_link = [ + str(m) for m in match.loser_matches + ] if match.loser_matches is not None else [] + place_loser_link = [] + place_winner_link = [] + if 'starting_position_indicators' in self.page \ + and self.page['starting_position_indicators']: + for team in match.teams: + if len(team.place) > 0: + place_link = ['place-' + str(pl) for pl in team.place] + if len(team.place) > 1: + place_loser_link += place_link + else: + place_winner_link += place_link return self.p_temp.get( 'MATCH_BOX', position[0], position[1], match.id, - ' '.join([ - str(m) for m in match.winner_matches - ]) if match.winner_matches is not None else '', - ' '.join([ - str(m) for m in match.loser_matches - ]) if match.loser_matches is not None else '', + ' '.join(winner_link), + ' '.join(loser_link), + ' '.join(place_winner_link), + ' '.join(place_loser_link), self.get_match_table(match)) return '' diff --git a/jfr_playoff/template.py b/jfr_playoff/template.py index 3473530..7b91b3b 100644 --- a/jfr_playoff/template.py +++ b/jfr_playoff/template.py @@ -92,7 +92,7 @@ class PlayoffTemplateStrings(object): ''' MATCH_BOX = ''' -
+
%s
''' -- cgit v1.2.3