Improve the frontend and fix TODOs
This commit is contained in:
@@ -27,6 +27,7 @@ from shared.monitoring.metrics import get_metrics_collector
|
||||
from app.core.config import settings
|
||||
from shared.routing import RouteBuilder
|
||||
from shared.auth.access_control import require_user_role, analytics_tier_required
|
||||
from shared.clients.tenant_client import TenantServiceClient
|
||||
|
||||
route_builder = RouteBuilder('forecasting')
|
||||
logger = structlog.get_logger()
|
||||
@@ -88,12 +89,24 @@ async def simulate_scenario(
|
||||
baseline_forecasts = []
|
||||
if request.include_baseline:
|
||||
logger.info("Generating baseline forecasts", tenant_id=tenant_id)
|
||||
|
||||
# Get tenant location (city) from tenant service
|
||||
location = "default"
|
||||
try:
|
||||
tenant_client = TenantServiceClient(settings)
|
||||
tenant_info = await tenant_client.get_tenant(tenant_id)
|
||||
if tenant_info and tenant_info.get('city'):
|
||||
location = tenant_info['city']
|
||||
logger.info("Using tenant location for forecasts", tenant_id=tenant_id, location=location)
|
||||
except Exception as e:
|
||||
logger.warning("Failed to get tenant location, using default", error=str(e), tenant_id=tenant_id)
|
||||
|
||||
for product_id in request.inventory_product_ids:
|
||||
forecast_request = ForecastRequest(
|
||||
inventory_product_id=product_id,
|
||||
forecast_date=request.start_date,
|
||||
forecast_days=request.duration_days,
|
||||
location="default" # TODO: Get from tenant settings
|
||||
location=location
|
||||
)
|
||||
multi_day_result = await forecasting_service.generate_multi_day_forecast(
|
||||
tenant_id=tenant_id,
|
||||
|
||||
Reference in New Issue
Block a user