store: Fix: Win percentage orientation bug - sheet gives leading team's win%, not home team's
This commit is contained in:
parent
6a4ea2dfc9
commit
f5ac164eda
@ -0,0 +1,37 @@
|
||||
---
|
||||
id: 4c2c50d7-febe-43f6-a264-d586b24f49d6
|
||||
type: fix
|
||||
title: "Fix: Win percentage orientation bug - sheet gives leading team's win%, not home team's"
|
||||
tags: [major-domo, scorebug, win-probability, fix, orientation, google-sheets, discord-bot]
|
||||
importance: 0.75
|
||||
confidence: 0.8
|
||||
created: "2026-02-20T20:06:21.331952+00:00"
|
||||
updated: "2026-02-20T20:06:21.331952+00:00"
|
||||
---
|
||||
|
||||
# Fix: Win Percentage Orientation Bug
|
||||
|
||||
## Problem
|
||||
The Google Sheet Scorebug tab outputs:
|
||||
- `C8` = winning team abbreviation
|
||||
- `D8` = that team's win probability percentage
|
||||
|
||||
The code was treating `D8` as the home team's win% unconditionally. When the away team was winning (e.g., DEN at 95%), the progress bar incorrectly showed the home team (MKE) as favored at 95%.
|
||||
|
||||
## Root Cause
|
||||
`create_team_progress_bar()` always expects the value from the home team's perspective. The sheet does not guarantee that perspective — it gives the leading team's perspective.
|
||||
|
||||
## Fix (`services/scorebug_service.py`)
|
||||
1. Read `C8` (`all_data[6][1]`) to get the leading team abbreviation.
|
||||
2. Compare it to the home team abbreviation from `game_state[4][1]`.
|
||||
3. If the leading team is the **away** team, flip the value: `win_percentage = 100 - win_percentage`.
|
||||
|
||||
This ensures `create_team_progress_bar` always receives the correct home-team-perspective value.
|
||||
|
||||
## Key Detail
|
||||
Sheet row/column indices (0-based):
|
||||
- `all_data[6][1]` = C8 (leading team abbreviation)
|
||||
- `game_state[4][1]` = home team abbreviation
|
||||
|
||||
## Closes
|
||||
Issue #38 (implied by scorebug bug batch). Branch: `fix/scorebug-bugs`.
|
||||
Loading…
Reference in New Issue
Block a user