05/23 Phase 18,19

This commit is contained in:
2026-05-23 16:31:55 -04:00
parent 7506e94d61
commit 2553406254
9 changed files with 674 additions and 5 deletions
+32
View File
@@ -341,6 +341,38 @@ All actions are logged to console and optionally to a log file:
---
### ✅ 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
- [x] Update `ui/dashboard.py`
- [x] Import `gap_analysis` from `core.analyzer`
- [x] Add "Most Overdue Numbers" section below Hot Numbers
- [x] `_refresh_overdue()` — top-5 highest-gap numbers per active game, shown as orange-highlighted `BallsBar` with gap counts
- [x] Called from `refresh()`
- [x] Update `ui/settings.py`
- [x] Import `backup_db, restore_db` from `db.database`
- [x] Add "Database Actions" section with Backup DB + Restore DB buttons
- [x] `_backup_db()` — runs backup, shows path in success dialog
- [x] `_restore_db()` — file dialog, confirm prompt, restores, advises restart
- [x] Write `tests/test_backup.py` — 10 tests (361/361 total passing)
---
### ✅ Phase 18 — Draw CSV Import
- [x] Write `core/importer.py`
- [x] `_parse_date(text)` — accepts ISO (YYYY-MM-DD), US slash (MM/DD/YYYY), US dash, day-first formats
- [x] `_is_header(row)` — heuristic: first cell is not a valid date
- [x] `_parse_row_lottosight` — handles LottoSight's own export format (Game, Date, Numbers, Bonus, …)
- [x] `_parse_row_generic` — handles wide format (Date, N1, N2, …) and packed format (Date, "N1,N2,…")
- [x] `import_draws_csv(game_id, filepath) -> {added, skipped, errors}` — validates count + range, calls `insert_draw`, deduplicates via existing DB logic
- [x] Update `ui/settings.py`
- [x] Add `filedialog` import
- [x] "Import CSV" button on every game row (builtin and custom)
- [x] `_import_csv(game_id, game_name)` — file dialog → import → show summary with error preview → refresh games
- [x] Write `tests/test_importer.py` — 23 tests (351/351 total passing)
---
### ✅ Phase 17 — Predictor Power Features
- [x] Add `quick_pick(game_id, exclude=None)` to `core/predictor.py` — pure random, no draw history required
- [x] Add `exclude: set | None = None` parameter to all 5 existing strategies + `_random_ticket` + `_fill_to_count`