From 18c6e0da4f4cbb3629dfa368a0716529f011eabe Mon Sep 17 00:00:00 2001 From: Deeman Date: Thu, 19 Feb 2026 22:48:53 +0100 Subject: [PATCH] Fix dashboard routes after copier update - Remove import of get_user_with_subscription (function was removed) - Use g.user and g.subscription from eager loading instead - Fixes ImportError in dashboard routes Co-Authored-By: Claude Sonnet 4 --- web/src/beanflows/dashboard/routes.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/web/src/beanflows/dashboard/routes.py b/web/src/beanflows/dashboard/routes.py index 11f3b7f..27702f2 100644 --- a/web/src/beanflows/dashboard/routes.py +++ b/web/src/beanflows/dashboard/routes.py @@ -10,7 +10,7 @@ from pathlib import Path from quart import Blueprint, flash, g, jsonify, redirect, render_template, request, url_for from .. import analytics -from ..auth.routes import get_user_with_subscription, login_required, update_user +from ..auth.routes import login_required, update_user from ..billing.routes import get_subscription from ..core import csrf_protect, execute, fetch_all, fetch_one, soft_delete @@ -95,9 +95,9 @@ async def delete_api_key(key_id: int, user_id: int) -> bool: @login_required async def index(): """Coffee analytics dashboard.""" - user = await get_user_with_subscription(g.user["id"]) + user = g.user stats = await get_user_stats(g.user["id"]) - plan = user.get("plan") or "free" + plan = g.get("subscription", {}).get("plan", "free") # Fetch all analytics data in parallel (empty lists if DB not available) if analytics._conn is not None: @@ -143,8 +143,8 @@ async def index(): @login_required async def countries(): """Country comparison page.""" - user = await get_user_with_subscription(g.user["id"]) - plan = user.get("plan") or "free" + user = g.user + plan = g.get("subscription", {}).get("plan", "free") # Get available countries for coffee all_countries = await analytics.get_top_countries(analytics.COFFEE_COMMODITY_CODE, "Production", limit=50) @@ -193,8 +193,8 @@ async def settings(): await flash("Settings saved!", "success") return redirect(url_for("dashboard.settings")) - user = await get_user_with_subscription(g.user["id"]) - subscription = await get_subscription(g.user["id"]) + user = g.user + subscription = g.get("subscription") api_keys = await get_user_api_keys(g.user["id"]) return await render_template(