From a4ce8a9d50656da57af537cd6c772071f48049d8 Mon Sep 17 00:00:00 2001 From: Rolf Date: Tue, 24 Mar 2026 08:18:32 +0100 Subject: [PATCH] Fix stroke index display when SI is per-tee only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit has_stroke_index was derived solely from course_holes.stroke_index, but stroke indices can also be stored as JSON on course_tees (stroke_indices column), which is what's used at game creation to compute strokes_allocation per player. Courses imported from the API often have per-tee SI but no course-level hole SI, causing has_stroke_index = False even though every player had valid stroke data — hiding the +N badges and scorecard slash markers entirely. Fix: fall back to checking whether any player actually has stroke data in strokes_per_hole, applied to both game_page and game_summary. Co-Authored-By: Claude Sonnet 4.6 --- app/routers/games.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/routers/games.py b/app/routers/games.py index c811379..1f7b6fd 100644 --- a/app/routers/games.py +++ b/app/routers/games.py @@ -404,7 +404,7 @@ async def game_summary(game_id: str, request: Request, user: dict = Depends(get_ playing_handicaps = {p["id"]: p.get("playing_handicap") for p in players} computed = _strokes_per_hole(players, holes, hole_stroke_indices) strokes_per_hole = {p["id"]: p["strokes_allocation"] or computed.get(p["id"], {}) for p in players} - has_stroke_index = bool(hole_stroke_indices) + has_stroke_index = bool(hole_stroke_indices) or any(strokes_per_hole.values()) skins_won, skins_hole_results, unclaimed, money_won, unclaimed_money = None, None, 0, None, 0.0 skin_value = game["skin_value"] @@ -464,7 +464,7 @@ async def game_page(game_id: str, request: Request, user: dict = Depends(get_cur computed = _strokes_per_hole(players, holes, hole_stroke_indices) strokes_per_hole = {p["id"]: p["strokes_allocation"] or computed.get(p["id"], {}) for p in players} - has_stroke_index = bool(hole_stroke_indices) + has_stroke_index = bool(hole_stroke_indices) or any(strokes_per_hole.values()) return templates.TemplateResponse("games/game.html", { "request": request, "user": user, "game": dict(game),