import sqlite3
from datetime import datetime
conn = sqlite3.connect('/home/h3r7/turf_scraper/turf.db')
c = conn.cursor()

# Add odds from scraper data
today = '2026-02-24'
now = datetime.now().strftime('%H:%M')

odds_data = {
    7: 4.0,    # I'M A BELIEVER
    1: 7.3,    # PRINCE DE MONTFORT
    3: 6.7,    # GRAND BALCON
    8: 18.0,   # PAOLINO
    11: 19.0,  # INCREMENTAL
    15: 13.0,  # PRINCESSE SAPHIR
    16: 30.0,  # GOLD PLAYER
    14: 18.0   # WEEMAGATEE
}

for num, odds in odds_data.items():
    c.execute('UPDATE predictions SET odds = ?, odds_time = ? WHERE date = ? AND horse_number = ?',
              (odds, now, today, num))

conn.commit()
print("Odds updated!")

c.execute('SELECT horse_number, horse_name, odds, odds_time FROM predictions WHERE date = ? ORDER BY prediction_rank', (today,))
for r in c.fetchall():
    print(f"  {r[0]} - {r[1]}: {r[2]}/1 à {r[3]}")

conn.close()
