--- id: 8ce81bc9-3bce-44a9-89e8-c01e54e6df7a type: fix title: "Fix: Scorebug win probability orientation — C8=winning team, D8=percentage" tags: [major-domo, scorebug, win-probability, google-sheets, fix, data-orientation] importance: 0.7 confidence: 0.8 created: "2026-02-20T20:30:15.225730+00:00" updated: "2026-02-20T20:30:15.225730+00:00" --- # Scorebug Win Probability Orientation Bug ## Project major-domo / discord-app-v2 ## File `services/scorebug_service.py` ## Google Sheets Layout The scorecard outputs: - **C8** (`all_data[6][1]`): winning team's abbreviation - **D8**: that team's win probability percentage ## Problem Code was treating D8 as always the **home team's** win%, regardless of which team C8 named. This produced an inverted win probability whenever the away team was winning. ## Fix Read C8 and compare to the home team abbreviation (from `game_state[4][1]`). ```python winning_team_abbr = all_data[6][1] # C8 home_team_abbr = game_state[4][1] win_percentage = float(d8_value) if winning_team_abbr != home_team_abbr: win_percentage = 100 - win_percentage # flip to home team's perspective ``` `ScorebugData.win_percentage` is always stored from the **home team's perspective**. ## Key Takeaway When consuming a spreadsheet that outputs "winning team + that team's probability," always check orientation and normalize to a consistent perspective before storing.