Created
June 7, 2026 10:18
-
-
Save dcsportsfan23/1894b14ebfa88c09b2595987d592df6d to your computer and use it in GitHub Desktop.
bet-bot diag v2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """Diagnostic v2: show what the bot's nightly job has done since 5/11.""" | |
| import sqlite3, os, sys, datetime | |
| DB = '/data/bets.sqlite3' | |
| if not os.path.exists(DB): | |
| print(f"FATAL: {DB} missing"); sys.exit(1) | |
| con = sqlite3.connect(DB) | |
| con.row_factory = sqlite3.Row | |
| c = con.cursor() | |
| # DB file stats | |
| mtime = datetime.datetime.fromtimestamp(os.path.getmtime(DB), datetime.timezone.utc) | |
| print(f"DB mtime: {mtime.isoformat()}") | |
| print(f"Now: {datetime.datetime.now(datetime.timezone.utc).isoformat()}") | |
| print(f"size: {os.path.getsize(DB):,} bytes") | |
| print(f"total: {c.execute('SELECT COUNT(*) FROM bets').fetchone()[0]}") | |
| print(f"pending: {c.execute(\"SELECT COUNT(*) FROM bets WHERE result='pending'\").fetchone()[0]}") | |
| # Check the 3 NASCAR rows specifically | |
| print("\n--- 4/26 NASCAR rows (should be 'loss' after last night's auto-resolve) ---") | |
| for r in c.execute(""" | |
| SELECT id, bet_date, author_name, selection, result, result_source, profit_units, corrected | |
| FROM bets | |
| WHERE bet_date = '2026-04-26' AND author_name='touch23' | |
| ORDER BY id | |
| """): | |
| print(f" id={r['id']} {r['selection']:<15} result={r['result']!r} src={r['result_source']!r} profit={r['profit_units']} corrected={r['corrected']!r}") | |
| # Check the 6/05 mhankin WNBA bets (graded in DB yesterday — should be loss/win in DB) | |
| print("\n--- 6/05 mhankin WNBA bets (graded in DB; should also be in sheet by now) ---") | |
| for r in c.execute(""" | |
| SELECT id, bet_date, selection, result, result_source, profit_units | |
| FROM bets | |
| WHERE bet_date='2026-06-05' AND author_name='mhankin' | |
| ORDER BY id | |
| """): | |
| print(f" id={r['id']} {r['selection']:<30} result={r['result']!r} src={r['result_source']!r}") | |
| # Has nightly job run since 5/11? | |
| print("\n--- recent auto_default rows (proves _run_auto_resolve has fired) ---") | |
| for r in c.execute(""" | |
| SELECT bet_date, author_name, selection, result_source | |
| FROM bets WHERE result_source='auto_default' | |
| ORDER BY bet_date DESC LIMIT 10 | |
| """): | |
| print(f" {r['bet_date']} {r['author_name']:<15} {r['selection'][:40]:<40} src={r['result_source']}") | |
| # Look for kv_store last_successful_daily_run | |
| print("\n--- kv_store (last_successful_daily_run = when bot last completed nightly) ---") | |
| try: | |
| for r in c.execute("SELECT * FROM kv_store ORDER BY key"): | |
| print(f" {dict(r)}") | |
| except Exception as e: | |
| print(f" ({e})") | |
| # What does the bot think is "pending" right now? | |
| print("\n--- ALL pending in live DB right now ---") | |
| for r in c.execute(""" | |
| SELECT bet_date, author_name, channel_name, substr(selection,1,40) sel, corrected, result_source | |
| FROM bets WHERE result='pending' | |
| ORDER BY bet_date | |
| """): | |
| print(f" {r['bet_date']} {r['author_name']:<15} {r['channel_name']:<12} {r['sel']:<40} corrected={r['corrected']!r} src={r['result_source']!r}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment