diff options
author | emkael <emkael@tlen.pl> | 2018-07-06 01:15:34 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2018-07-06 01:23:22 +0200 |
commit | 8a29e0818606032bdecdf794e644dbb55d5f09b5 (patch) | |
tree | 8d51c7a5a231094f7da0e979ff113020452d889c /jfr_playoff | |
parent | 00bb8ac06a45fd0cb960a7161a1f9cb713429a02 (diff) |
Generating connector info between matches and starting positions
Diffstat (limited to 'jfr_playoff')
-rw-r--r-- | jfr_playoff/generator.py | 27 | ||||
-rw-r--r-- | 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 = ''' - <div style="text-align: center; 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" data-place-winner="%s" data-place-loser="%s" class="playoff_matchbox"> %s </div> ''' |