style: tighten playoff card copy — uniform Game X of 7 header, leaner blurbs
Top row now always reads "Game N of 7" (round is already shown by the R1/R2/CONF FINAL/CUP FINAL badge). Bottom blurb drops the trailing period on "Series opener" and uses "{Team} lead X-Y" (plural verb, no "— Game N" suffix) when a leader is established.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+4
-9
@@ -106,9 +106,9 @@ def series_blurb(game):
|
|||||||
if state["is_pivotal"]:
|
if state["is_pivotal"]:
|
||||||
return f"Series tied 2\u20112 \u2014 pivotal Game {g}."
|
return f"Series tied 2\u20112 \u2014 pivotal Game {g}."
|
||||||
if state["is_opener"]:
|
if state["is_opener"]:
|
||||||
return "Series opener."
|
return "Series opener"
|
||||||
if leader_name and trailer_name:
|
if leader_name and trailer_name:
|
||||||
return f"{leader_name} leads {state['hi']}\u2011{state['lo']} \u2014 Game {g}."
|
return f"{leader_name} lead {state['hi']}\u2011{state['lo']}"
|
||||||
if state["hi"] == state["lo"]:
|
if state["hi"] == state["lo"]:
|
||||||
return f"Series even at {state['hi']}\u2011{state['lo']} \u2014 Game {g}."
|
return f"Series even at {state['hi']}\u2011{state['lo']} \u2014 Game {g}."
|
||||||
return f"Game {g}."
|
return f"Game {g}."
|
||||||
@@ -135,14 +135,9 @@ def series_badges(game):
|
|||||||
|
|
||||||
|
|
||||||
def series_summary(game):
|
def series_summary(game):
|
||||||
"""Short series-score line rendered under the blurb, e.g. 'LAK leads 2-1'."""
|
"""Short line rendered above the card, e.g. 'Game 2 of 7'."""
|
||||||
state = series_state(game.get("seriesStatus", {}))
|
state = series_state(game.get("seriesStatus", {}))
|
||||||
if state["is_opener"]:
|
return f"Game {state['game_number']} of 7"
|
||||||
return f"Game 1 of 7 \u00b7 Round {state['round']}"
|
|
||||||
leader_name = _leader_name(game, state)
|
|
||||||
if leader_name:
|
|
||||||
return f"{leader_name} leads {state['hi']}\u2011{state['lo']}"
|
|
||||||
return f"Series tied {state['hi']}\u2011{state['lo']}"
|
|
||||||
|
|
||||||
|
|
||||||
def is_pinned(game):
|
def is_pinned(game):
|
||||||
|
|||||||
+2
-1
@@ -775,7 +775,8 @@ class TestPlayoffEnrichment:
|
|||||||
g = result[0]
|
g = result[0]
|
||||||
assert g["Is Playoff"] is True
|
assert g["Is Playoff"] is True
|
||||||
assert g["Pinned"] is False
|
assert g["Pinned"] is False
|
||||||
assert "Game 4" in g["Series Blurb"]
|
assert "lead" in g["Series Blurb"]
|
||||||
|
assert g["Series Summary"] == "Game 4 of 7"
|
||||||
assert "R1" in g["Series Badges"]
|
assert "R1" in g["Series Badges"]
|
||||||
|
|
||||||
def test_game7_is_pinned(self, mocker):
|
def test_game7_is_pinned(self, mocker):
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class TestSeriesState:
|
|||||||
class TestSeriesBlurb:
|
class TestSeriesBlurb:
|
||||||
def test_opener_blurb(self):
|
def test_opener_blurb(self):
|
||||||
game = make_playoff_game(top_wins=0, bottom_wins=0)
|
game = make_playoff_game(top_wins=0, bottom_wins=0)
|
||||||
assert series_blurb(game) == "Series opener."
|
assert series_blurb(game) == "Series opener"
|
||||||
|
|
||||||
def test_game7_blurb(self):
|
def test_game7_blurb(self):
|
||||||
game = make_playoff_game(top_wins=3, bottom_wins=3)
|
game = make_playoff_game(top_wins=3, bottom_wins=3)
|
||||||
@@ -96,8 +96,8 @@ class TestSeriesBlurb:
|
|||||||
def test_leader_trailer_blurb(self):
|
def test_leader_trailer_blurb(self):
|
||||||
game = make_playoff_game(top_wins=2, bottom_wins=1)
|
game = make_playoff_game(top_wins=2, bottom_wins=1)
|
||||||
blurb = series_blurb(game)
|
blurb = series_blurb(game)
|
||||||
assert "leads" in blurb
|
assert "lead" in blurb
|
||||||
assert "Game 4" in blurb
|
assert "2\u20111" in blurb
|
||||||
|
|
||||||
def test_tied_mid_series_blurb(self):
|
def test_tied_mid_series_blurb(self):
|
||||||
game = make_playoff_game(top_wins=1, bottom_wins=1)
|
game = make_playoff_game(top_wins=1, bottom_wins=1)
|
||||||
@@ -139,15 +139,15 @@ class TestSeriesBadges:
|
|||||||
class TestSeriesSummary:
|
class TestSeriesSummary:
|
||||||
def test_opener_summary(self):
|
def test_opener_summary(self):
|
||||||
game = make_playoff_game(top_wins=0, bottom_wins=0, round_num=1)
|
game = make_playoff_game(top_wins=0, bottom_wins=0, round_num=1)
|
||||||
assert "Round 1" in series_summary(game)
|
assert series_summary(game) == "Game 1 of 7"
|
||||||
|
|
||||||
def test_leader_summary(self):
|
def test_leader_summary(self):
|
||||||
game = make_playoff_game(top_wins=2, bottom_wins=1)
|
game = make_playoff_game(top_wins=2, bottom_wins=1)
|
||||||
assert "leads" in series_summary(game)
|
assert series_summary(game) == "Game 4 of 7"
|
||||||
|
|
||||||
def test_tied_mid_series_summary(self):
|
def test_tied_mid_series_summary(self):
|
||||||
game = make_playoff_game(top_wins=1, bottom_wins=1)
|
game = make_playoff_game(top_wins=1, bottom_wins=1)
|
||||||
assert "tied" in series_summary(game).lower()
|
assert series_summary(game) == "Game 3 of 7"
|
||||||
|
|
||||||
|
|
||||||
class TestIsPinned:
|
class TestIsPinned:
|
||||||
|
|||||||
Reference in New Issue
Block a user