From 16acb9c51e9d22fba675ff179a62f511ce30323f Mon Sep 17 00:00:00 2001 From: uberfastman <4575707+uberfastman@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:23:08 -0400 Subject: [PATCH] added alternating colored rows to tables and updated truncating --- compose.yaml | 2 +- report/pdf/generator.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/compose.yaml b/compose.yaml index bb573fe..d70eb49 100644 --- a/compose.yaml +++ b/compose.yaml @@ -2,7 +2,7 @@ services: app: - image: ghcr.io/uberfastman/fantasy-football-metrics-weekly-report:19.2.0 + image: ghcr.io/uberfastman/fantasy-football-metrics-weekly-report:19.2.1 platform: linux/amd64 ports: - "5001:5000" diff --git a/report/pdf/generator.py b/report/pdf/generator.py index e14ca4e..f4cc8c7 100644 --- a/report/pdf/generator.py +++ b/report/pdf/generator.py @@ -371,6 +371,7 @@ def __init__(self, season: int, league: BaseLeague, playoff_prob_sims: int, ("BOX", (0, 0), (-1, -1), 0.5, colors.black), ("INNERGRID", (0, 0), (-1, -1), 0.25, colors.black), ("VALIGN", (0, 0), (-1, 0), "MIDDLE"), + ("ROWBACKGROUNDS", (0, 0), (-1, -1), [colors.white, colors.whitesmoke]), # alternate row colors ("BACKGROUND", (0, 0), (-1, 0), colors.lightgrey) ] @@ -679,8 +680,8 @@ def create_section(self, title_text: str, toc_section_key: str, headers: List[Li toc_section_key, color=( "green" if self.break_ties and ( - title == "Team Score Rankings" - or title == "Team Coaching Efficiency Rankings" + title_text == "Team Score Rankings" + or title_text == "Team Coaching Efficiency Rankings" ) else None ) ) @@ -959,7 +960,7 @@ def create_data_table(self, metric_type: str, col_headers: List[List[str]], data # reduce manager string max characters for standings metric to accommodate narrower column widths manager_header_ndx = None - if metric_type == "standings": + if metric_type == "standings" or metric_type == "playoffs": for header_ndx, header in enumerate(col_headers[0]): if header == "Manager": manager_header_ndx = header_ndx @@ -969,8 +970,8 @@ def create_data_table(self, metric_type: str, col_headers: List[List[str]], data for cell_ndx, cell in enumerate(row): if isinstance(cell, str): if cell_ndx not in sesqui_max_chars_col_ndxs: - # truncate data cell contents to specified max characters and half of specified max characters if - # cell is a team manager header + # truncate data cell contents to specified max characters and half of specified max characters + # if cell is a team manager header display_row.append( truncate_cell_for_display(cell, halve_max_chars=(cell_ndx == manager_header_ndx)) )