summaryrefslogtreecommitdiff
path: root/jfr_playoff/generator.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2018-04-25 12:44:27 +0200
committeremkael <emkael@tlen.pl>2018-04-25 12:44:27 +0200
commitb62a0aaa38a63e7ce769fc698da39b5b8c81849c (patch)
treecc9072ee225967534ee32ff166924b868604a47e /jfr_playoff/generator.py
parent753085c46b30828092e66870f15763fee02b32f7 (diff)
Add config-specified classes to leaderboard positions
Diffstat (limited to 'jfr_playoff/generator.py')
-rw-r--r--jfr_playoff/generator.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/jfr_playoff/generator.py b/jfr_playoff/generator.py
index cc4469d..5ce7d4d 100644
--- a/jfr_playoff/generator.py
+++ b/jfr_playoff/generator.py
@@ -11,6 +11,9 @@ class PlayoffGenerator(object):
self.canvas = {}
if settings.has_section('canvas'):
self.canvas = settings.get('canvas')
+ self.leaderboard_classes = {}
+ if settings.has_section('position_styles'):
+ self.leaderboard_classes = settings.get('position_styles')
def generate_content(self):
return p_temp.PAGE % (
@@ -119,6 +122,13 @@ class PlayoffGenerator(object):
grid_boxes
)
+ def get_leaderboard_row_class(self, position):
+ classes = []
+ for style in self.leaderboard_classes:
+ if position in style['positions']:
+ classes.append(style['class'])
+ return ' '.join(classes)
+
def get_leaderboard_table(self):
leaderboard = self.data.fill_leaderboard()
if len([t for t in leaderboard if t is not None]) == 0:
@@ -127,6 +137,7 @@ class PlayoffGenerator(object):
rows = ''
for team in leaderboard:
rows += p_temp.LEADERBOARD_ROW % (
+ self.get_leaderboard_row_class(position),
position, self.get_flag(team), team or '')
position += 1
html = p_temp.LEADERBOARD.decode('utf8') % (rows)