store: Fix: Win percentage parsing robustness and None default in ScorebugData
This commit is contained in:
parent
873394d113
commit
fefc3e2f91
@ -0,0 +1,34 @@
|
|||||||
|
---
|
||||||
|
id: afbc470d-05a6-4f5a-8835-b3cdf6ecba8c
|
||||||
|
type: fix
|
||||||
|
title: "Fix: Win percentage parsing robustness and None default in ScorebugData"
|
||||||
|
tags: [major-domo, scorebug, win-probability, fix, parsing, discord-bot]
|
||||||
|
importance: 0.65
|
||||||
|
confidence: 0.8
|
||||||
|
created: "2026-02-20T20:06:11.768716+00:00"
|
||||||
|
updated: "2026-02-20T20:06:11.768716+00:00"
|
||||||
|
---
|
||||||
|
|
||||||
|
# Fix: Win Percentage Parsing Robustness
|
||||||
|
|
||||||
|
## Problem
|
||||||
|
`ScorebugData.__init__` defaulted `win_percentage` to `50.0` when the field was absent or empty, causing the embed to show a misleading 50/50 probability bar instead of indicating unavailability.
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
### `models/scorebug_data.py` (ScorebugData)
|
||||||
|
- Changed default: `data.get("win_percentage")` instead of `data.get("win_percentage", 50.0)`
|
||||||
|
- `win_percentage` is now `Optional[float]`, defaulting to `None`
|
||||||
|
|
||||||
|
### `services/scorebug_service.py`
|
||||||
|
Parsing now handles edge cases:
|
||||||
|
- Empty string → `None`
|
||||||
|
- Decimal range `0.0–1.0` → multiply by 100 (sheet may give raw probability)
|
||||||
|
- Unparseable value → `None` with INFO log
|
||||||
|
|
||||||
|
### `utils/scorebug_helpers.py`
|
||||||
|
- When `win_percentage is None`, embed shows "-# Win probability unavailable" instead of a bar
|
||||||
|
- Embed color logic guards against `None` comparison (no `TypeError` on `win_percentage > 50`)
|
||||||
|
|
||||||
|
## Closes
|
||||||
|
Issue #39. Branch: `fix/scorebug-bugs`.
|
||||||
Loading…
Reference in New Issue
Block a user