From 6e090383ea1b561af29e696f3f56950d5c4e9ad5 Mon Sep 17 00:00:00 2001 From: emkael Date: Fri, 25 Jan 2019 18:17:02 +0100 Subject: Finishing position captions in tooltips --- jfr_playoff/generator.py | 9 ++++++++- jfr_playoff/template.py | 10 ++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'jfr_playoff') diff --git a/jfr_playoff/generator.py b/jfr_playoff/generator.py index 8bdb2d8..f1e2829 100644 --- a/jfr_playoff/generator.py +++ b/jfr_playoff/generator.py @@ -269,6 +269,7 @@ class PlayoffGenerator(object): boxes = '' order = 0 for place in sorted(positions): + caption = self.get_caption_for_finishing_position(place) boxes += self.p_temp.get( 'FINISHING_POSITION_BOX', self.page['margin'] / 2 + int(float(order) / float(len(positions)) * dimensions[1]), @@ -276,7 +277,7 @@ class PlayoffGenerator(object): place, ' '.join([str(p) for p in position_info[place]['winner']]), ' '.join([str(p) for p in position_info[place]['loser']]), - self.p_temp.get('POSITION_BOX', place)) + self.p_temp.get('CAPTIONED_POSITION_BOX', caption, place) if caption else self.p_temp.get('POSITION_BOX', place)) order += 1 return boxes @@ -356,6 +357,12 @@ class PlayoffGenerator(object): ) ) + def get_caption_for_finishing_position(self, position): + for style in self.leaderboard_classes: + if position in style['positions']: + return style['caption'] + return None + def get_leaderboard_row_class(self, position): classes = [] for style in self.leaderboard_classes: diff --git a/jfr_playoff/template.py b/jfr_playoff/template.py index a33afcc..fdfc107 100644 --- a/jfr_playoff/template.py +++ b/jfr_playoff/template.py @@ -107,6 +107,16 @@ class PlayoffTemplateStrings(object): ''' + CAPTIONED_POSITION_BOX = ''' + + + + +
+ %d +
+ ''' + MATCH_BOX = '''
%s -- cgit v1.2.3