fix(teams): resolve dividers from tab name + full title, not last notice row
Section titles are stacked single-cell rows: the "TipiLAN 2026 CS2" title
sits above notice rows ("If a team withdraws..."), and parse_team_sections
kept only the LAST one, so the notice clobbered the title and resolve_divider
saw no game/year keywords -> None -> teams never positioned.
- parse_team_sections now accumulates all single-cell rows above a header, so
the game/year title survives alongside the notices.
- _refresh_teams_sync resolves the divider from "<tab name> <section title>",
so the game is taken reliably from the CS2/LoL worksheet name while the year
still comes from the title, keeping year-scoped TEAM_DIVIDER_*_2026 vars.
- regression test: title survives notice rows and still resolves.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XPRsW4tazVtYi2jNzVQkre
This commit is contained in:
@@ -362,7 +362,11 @@ def parse_team_sections(rows: list[list]) -> list[TeamSection]:
|
||||
lineup_col = _find_col(rows[i], lambda c: c.strip().lower().startswith(_LINEUP_HEADER_PREFIX))
|
||||
if name_col is None or lineup_col is None:
|
||||
if (text := _merged_title(rows[i])) is not None:
|
||||
title = text
|
||||
# Accumulate every single-cell row above the header, not just the
|
||||
# last one: sheets stack the "TipiLAN 2026 CS2" title above notice
|
||||
# rows ("If a team withdraws..."), and the later notices must not
|
||||
# clobber the title whose keywords resolve_divider needs.
|
||||
title = f"{title} {text}".strip() if title else text
|
||||
i += 1
|
||||
continue
|
||||
rosters: dict[str, list[str]] = {}
|
||||
@@ -444,7 +448,10 @@ def _refresh_teams_sync() -> dict[str, list[str]]:
|
||||
dividers: dict[str, int] = {}
|
||||
for ws in spreadsheet.worksheets():
|
||||
for section in parse_team_sections(ws.get_all_values()):
|
||||
divider = resolve_divider(section.title)
|
||||
# Match on the tab name too ("CS2"/"LoL"): it names the game reliably
|
||||
# even when the game/year title row is shadowed by notice rows, while
|
||||
# the section title still supplies the year for year-scoped dividers.
|
||||
divider = resolve_divider(f"{ws.title} {section.title}")
|
||||
for team, players in section.rosters.items():
|
||||
rosters.setdefault(team, []).extend(players)
|
||||
if divider:
|
||||
|
||||
Reference in New Issue
Block a user