05/23 Phase 22

This commit is contained in:
2026-05-23 17:36:33 -04:00
parent edd2ed5660
commit 59789f3cfe
10 changed files with 358 additions and 23 deletions
+27
View File
@@ -376,6 +376,33 @@ All actions are logged to console and optionally to a log file:
---
### ✅ Phase 22 — Incremental VA Fetch + Top Prize + Dashboard Filter + Auto-Check
- [x] Incremental VA fetch in `core/fetcher.py`
- [x] `_fetch_va_lottery()` calls `get_last_draw()` for last known date
- [x] Breaks out of parsing loop when `draw_date <= last_date` (data is newest-first)
- [x] Result: subsequent fetches only download new records, not all 10K+ rows
- [x] `top_prize` column in `db/database.py`
- [x] Added `top_prize TEXT NOT NULL DEFAULT ''` to `CREATE TABLE games`
- [x] ALTER TABLE migration for existing databases (checks via `PRAGMA table_info`)
- [x] Updated `_seed_games()` with prize strings for all 5 builtin games
- [x] Back-fills `top_prize` for existing rows where empty (safe to re-run)
- [x] Dashboard game filter in `ui/dashboard.py`
- [x] `_filter_var` combobox at top ("All Games" + active game names)
- [x] `_update_filter_options()` — keeps combobox in sync with active games
- [x] `_filtered_games()` — returns subset based on selection
- [x] Last Draws, Hot Numbers, Overdue sections all respect filter
- [x] Top prize display in last-draw cards (`ui/dashboard.py`)
- [x] Shows "Top prize: $X" in purple above draw date if `top_prize` is set
- [x] VA source names added to `ui/statusbar.py` `_SOURCE_NAMES`
- [x] `append_match_alert(msg)` method added to `StatusBar`
- [x] Auto-check predictions after fetch in `main.py`
- [x] `_check_predictions_vs_latest()` — compares all saved predictions against newest draw per game
- [x] Called from `_on_fetch_done()` when `total_added > 0`
- [x] Status bar shows alert when ≥1 prediction matches ≥2 main numbers or bonus
- [x] `tests/test_phase22.py` — 14 tests (403/403 total passing)
---
### ✅ Phase 19 — Dashboard Overdue Alert + DB Backup
- [x] Add `backup_db(dest_dir=None) -> str` to `db/database.py` — copies live DB to timestamped file, creates dest dir if needed
- [x] Add `restore_db(source_path: str) -> None` to `db/database.py` — overwrites live DB with backup file, raises FileNotFoundError if missing