From 2933caa662921883884d5bb5fe7c730341873a89 Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 6 Jun 2019 12:45:08 +0200 Subject: Fix for overlapping lines if match boxes are wider than expected --- playoff.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/playoff.js b/playoff.js index 3b57cdf..e83c33f 100644 --- a/playoff.js +++ b/playoff.js @@ -198,6 +198,18 @@ var playoff = { (lines.vTo[1] + lines.vTo[3]) / 2 ] ] + for (var h in lines.hTo) { + lines.hTo[h][2] = Math.max( + lines.hTo[h][2], + lines.midpoints[2][0] + ); + } + for (var h in lines.hFrom) { + lines.hFrom[h][2] = Math.min( + lines.hFrom[h][2], + lines.midpoints[0][0] + ); + } return lines; } }; @@ -220,10 +232,12 @@ var playoff = { } this.drawLine(ctx, linesToDraw.vTo); for (var m = 0; m < linesToDraw.midpoints.length-1; m++) { - this.drawLine(ctx, [ - linesToDraw.midpoints[m][0], linesToDraw.midpoints[m][1], - linesToDraw.midpoints[m+1][0], linesToDraw.midpoints[m+1][1] - ]); + if (linesToDraw.midpoints[m][0] <= linesToDraw.midpoints[m+1][0]) { + this.drawLine(ctx, [ + linesToDraw.midpoints[m][0], linesToDraw.midpoints[m][1], + linesToDraw.midpoints[m+1][0], linesToDraw.midpoints[m+1][1] + ]); + } } } } -- cgit v1.2.3 From cbb990edded54dd1c3f6d20c5737cbf48a364476 Mon Sep 17 00:00:00 2001 From: emkael Date: Sat, 9 Nov 2019 21:03:17 +0100 Subject: Custom order for final leaderboard positions is configurable --- jfr_playoff/data.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/jfr_playoff/data.py b/jfr_playoff/data.py index 107f012..f4adf6f 100644 --- a/jfr_playoff/data.py +++ b/jfr_playoff/data.py @@ -13,6 +13,15 @@ class PlayoffData(object): if self.database is None: PlayoffLogger.get('db').warning(PlayoffDB.DATABASE_NOT_CONFIGURED_WARNING) self.team_settings = settings.get('teams') + self.custom_final_order = [] + if settings.has_section('custom_final_order'): + self.custom_final_order = settings.get('custom_final_order') + self.custom_final_order = [ + t for t in [ + self.teams[i-1] if isinstance(i, int) + else self.get_team_data_by_name(i) + for i in self.custom_final_order] + if t is not None] self.phases = settings.get('phases') self.swiss = [] if settings.has_section('swiss'): @@ -127,6 +136,13 @@ class PlayoffData(object): leaderboard_teams[loser_key] = [] leaderboard_teams[loser_key].append( self.match_info[match['id']].loser) + final_order = self.custom_final_order + [ + t for t in self.teams if t not in self.custom_final_order] + PlayoffLogger.get('data').info( + 'custom order for final positions: %s', self.custom_final_order) + PlayoffLogger.get('data').info( + 'order of teams to fill leaderboard positions: %s', + final_order) for positions, position_teams in leaderboard_teams.iteritems(): positions = list(positions) PlayoffLogger.get('data').info( @@ -134,7 +150,7 @@ class PlayoffData(object): positions, position_teams) if len(positions) == len([ team for team in position_teams if team is not None]): - for table_team in self.teams: + for table_team in final_order: if table_team[0] in position_teams: position = positions.pop(0) self.leaderboard[position-1] = table_team[0] @@ -165,6 +181,12 @@ class PlayoffData(object): PlayoffLogger.get('data').info('grid dimensions: %s', dimensions) return dimensions + def get_team_data_by_name(self, fullname): + for team in self.teams: + if team[0] == fullname: + return team + return None + def get_shortname(self, fullname): for team in self.teams: if team[0] == fullname: -- cgit v1.2.3 From ec211c53adbc6d88e58a32943adaed2ae9d802b7 Mon Sep 17 00:00:00 2001 From: emkael Date: Sat, 9 Nov 2019 23:51:14 +0100 Subject: Custom final order documentation --- CONFIG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CONFIG.md b/CONFIG.md index b635660..0dcf701 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -124,6 +124,15 @@ Na przykład: Wszystkie zdefiniowane w takim słowniku nazwy teamów będą rozpoznawane jako właściwe nazwy, obecne w liście teamów. +Ustawienia teamów - kolejność końcowa +------------------------------------- + +W przypadku zdefiniowania zajmowania przez kilka teamów kilku pozycji końcowych w klasyfikacji, teamy szeregowane są według kolejności na wczytywanej (bądź określonej) liście teamów (np. pobranej z turnieju lub bazy danych). + +Aby zmienić tę kolejność (bo np. nie zawsze rozstrzygnięcie kolejności końcowej opiera się o kolejność po fazie zasadniczej), można określić w konfiguracji sekcję`custom_final_order`. + +Jest ona tablicą wartości: wartością może być łańcuch tekstowy - pełna nazwa teamu lub liczba - jego pozycja w pobranej liście teamów. + Ustawienia stylów klasyfikacji końcowej --------------------------------------- -- cgit v1.2.3