05/23 Phase 14

This commit is contained in:
2026-05-23 12:58:57 -04:00
parent ae0c64f731
commit 8eea1e976f
9 changed files with 851 additions and 2 deletions
+35
View File
@@ -325,6 +325,41 @@ All actions are logged to console and optionally to a log file:
---
### ✅ Phase 13 — Ticket Checker
- [x] Write `core/checker.py`
- [x] `prize_tier(main_matches, bonus_match)` — maps match counts to Jackpot/Match 5/Match 4+Bonus/… tier labels
- [x] `check_ticket(game_id, numbers, bonus)` — compares ticket against all draws, returns matches sorted by quality desc
- [x] `parse_numbers(raw)` — parses space- or comma-separated user input, raises ValueError on bad input
- [x] Add "Check Ticket" tab to `ui/predictor_ui.py` (3rd tab in Notebook)
- [x] Game dropdown, Numbers entry, Bonus entry, Check / Clear buttons
- [x] Hint label with accepted input format
- [x] Results treeview: Draw Date, Draw Numbers, Bonus, Main Hits, Bonus Hit, Prize Tier
- [x] Row colours: purple=Jackpot, green=≥3 matches or bonus hit, grey=low match
- [x] Summary bar: "N draws matched • Best: <tier>"
- [x] Input validation: number count, range check, bonus range
- [x] 27 tests in `tests/test_checker.py` (254/254 total passing)
---
### ✅ Phase 14 — Custom Game Management
- [x] Add `_BUILTIN_GAMES = {"Powerball", "Mega Millions"}` constant to `db/models.py`
- [x] Add `add_game(name, main_count, main_max, bonus_count, bonus_max) -> int`
- [x] Rejects blank names, duplicate names, and builtin game names (ValueError)
- [x] Inserts with `active=1`, returns new row id
- [x] Add `delete_game(game_id) -> bool`
- [x] Refuses builtin games → returns False
- [x] Refuses games with existing draw records → returns False
- [x] Cascades: deletes predictions for game first, then removes game → returns True
- [x] Update `ui/settings.py`
- [x] Delete button on each non-builtin game row; warns if draws exist, asks confirm
- [x] "+ Add Custom Game" button at bottom of Games section
- [x] `_AddGameDialog` modal (tk.Toplevel): name + main_count/max + bonus_count/max spinboxes
- [x] Error label in dialog for inline validation feedback
- [x] Refresh games list after add or delete
- [x] Write `tests/test_custom_games.py` — 20 tests (274/274 total passing)
---
### ✅ Phase 12 — Number Search + Next Draw Schedule
- [x] Number search in History screen
- [x] Add `number` param to `get_draws_with_game()` — SQL: `',' || numbers || ',' LIKE ?` for exact boundary matching