"""Quick verification after JSON→DB migration"""
import sys
sys.path.insert(0, '/home/hmo/MoFin')

from mo_data import read_portfolio, read_decisions, read_watchlist

ok = 0
err = 0

for name, fn in [("portfolio", read_portfolio), ("decisions", read_decisions), ("watchlist", read_watchlist)]:
    try:
        r = fn()
        if name == "portfolio":
            n = len(r.get('holdings', []))
        elif name == "decisions":
            n = len(r.get('decisions', []))
        else:
            n = len(r.get('stocks', []))
        print(f"  {name}: {n} records OK")
        ok += 1
    except Exception as e:
        print(f"  {name}: ERROR -> {e}")
        err += 1

print(f"\n{ok}/3 passed, {err} errors")
