Skip to content

Commit

Permalink
added alternating colored rows to tables and updated truncating
Browse files Browse the repository at this point in the history
  • Loading branch information
uberfastman committed Oct 15, 2024
1 parent 3a37d01 commit 16acb9c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 6 additions & 5 deletions report/pdf/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
]

Expand Down Expand Up @@ -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
)
)
Expand Down Expand Up @@ -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
Expand All @@ -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))
)
Expand Down

0 comments on commit 16acb9c

Please sign in to comment.