05/23 Phase 18,19
This commit is contained in:
+36
-1
@@ -15,7 +15,7 @@ from datetime import date, timedelta
|
||||
|
||||
from db.database import get_db_stats
|
||||
from db.models import get_all_games, get_last_draw, get_draw_count, get_predictions
|
||||
from core.analyzer import frequency_analysis
|
||||
from core.analyzer import frequency_analysis, gap_analysis
|
||||
from ui.widgets import BallsBar
|
||||
|
||||
# Weekday indices: Monday=0 … Sunday=6
|
||||
@@ -97,6 +97,7 @@ class DashboardScreen(ttk.Frame):
|
||||
self._last_draw_body = self._section_header("Last Draw Results")
|
||||
self._db_body = self._section_header("Database Summary")
|
||||
self._hot_body = self._section_header("Hot Numbers (last 100 draws)")
|
||||
self._overdue_body = self._section_header("Most Overdue Numbers")
|
||||
|
||||
# ── Refresh ───────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -104,6 +105,7 @@ class DashboardScreen(ttk.Frame):
|
||||
self._refresh_last_draws()
|
||||
self._refresh_db_summary()
|
||||
self._refresh_hot_numbers()
|
||||
self._refresh_overdue()
|
||||
|
||||
def _refresh_last_draws(self):
|
||||
for w in self._last_draw_body.winfo_children():
|
||||
@@ -194,3 +196,36 @@ class DashboardScreen(ttk.Frame):
|
||||
counts_str = " ".join(f"({freq[n]}×)" for n in top5)
|
||||
ttk.Label(row, text=counts_str, foreground="#aaaaaa",
|
||||
font=_CARD_FONT).pack(side="left")
|
||||
|
||||
def _refresh_overdue(self):
|
||||
for w in self._overdue_body.winfo_children():
|
||||
w.destroy()
|
||||
|
||||
games = get_all_games(active_only=True)
|
||||
if not games:
|
||||
ttk.Label(self._overdue_body, text="No active games.",
|
||||
foreground="#aaaaaa").pack(anchor="w")
|
||||
return
|
||||
|
||||
_ORANGE = ("#e67e22", "#ffffff")
|
||||
|
||||
for game in games:
|
||||
gaps = gap_analysis(game["id"]) # {number: gap}
|
||||
row = ttk.Frame(self._overdue_body)
|
||||
row.pack(fill="x", pady=3)
|
||||
|
||||
ttk.Label(row, text=f"{game['name']}:", width=18, anchor="w",
|
||||
font=_CARD_FONT).pack(side="left")
|
||||
|
||||
if not gaps:
|
||||
ttk.Label(row, text="No data yet.", foreground="#aaaaaa",
|
||||
font=_CARD_FONT).pack(side="left")
|
||||
continue
|
||||
|
||||
top5 = sorted(sorted(gaps, key=gaps.get, reverse=True)[:5])
|
||||
highlights = {n: _ORANGE for n in top5}
|
||||
BallsBar(row, numbers=top5, radius=11,
|
||||
highlights=highlights).pack(side="left", padx=(0, 6))
|
||||
gaps_str = " ".join(f"({gaps[n]} ago)" for n in top5)
|
||||
ttk.Label(row, text=gaps_str, foreground="#aaaaaa",
|
||||
font=_CARD_FONT).pack(side="left")
|
||||
|
||||
Reference in New Issue
Block a user