06/03 Optimize app

This commit is contained in:
2026-06-03 16:06:30 -04:00
parent 4af31a611e
commit ec1c0fc7c1
14 changed files with 447 additions and 12 deletions
+15 -1
View File
@@ -42,6 +42,19 @@ def index():
period = request.args.get('period', 'this_month')
date_from, date_to, period_label = _parse_date_range(period)
# ── Schwab token expiry check ─────────────────────
from app.models.schwab_connection import SchwabConnection
from datetime import timedelta
schwab_warning = None
schwab_conn = SchwabConnection.query.filter_by(is_active=True).first()
if schwab_conn and schwab_conn.refresh_token_expires_at:
days_left = (schwab_conn.refresh_token_expires_at - datetime.utcnow()).days
if days_left <= 2:
schwab_warning = (
f'Schwab connection expires in {max(days_left, 0)} day(s). '
f'Reconnect now to keep syncing.'
)
# ── Summary cards ────────────────────────────────
total_income = db.session.query(
func.coalesce(func.sum(Transaction.amount), 0)
@@ -150,7 +163,8 @@ def index():
recent_txns=recent_txns,
fx=fx,
fx_history_data=fx_history_data,
ai_insight=ai_insight)
ai_insight=ai_insight,
schwab_warning=schwab_warning)
@dashboard_bp.route('/api/fx-history')