diff --git a/services/orchestrator/app/services/dashboard_service.py b/services/orchestrator/app/services/dashboard_service.py index 1b8e0632..b7fbade6 100644 --- a/services/orchestrator/app/services/dashboard_service.py +++ b/services/orchestrator/app/services/dashboard_service.py @@ -352,8 +352,8 @@ class DashboardService: "type": ActionType.RESOLVE_ALERT, "urgency": ActionUrgency.CRITICAL, "title": alert["title"], - "subtitle": alert.get("source", "System Alert"), - "reasoning": alert.get("description", ""), + "subtitle": alert.get("source") or "System Alert", + "reasoning": alert.get("description") or "System alert requires attention", "consequence": "Immediate action required to prevent production issues", "actions": [ {"label": "View Details", "type": "primary", "action": "view_alert"}, @@ -373,8 +373,8 @@ class DashboardService: "urgency": urgency, "title": f"Purchase Order {po.get('po_number', 'N/A')}", "subtitle": f"Supplier: {po.get('supplier_name', 'Unknown')}", - "reasoning": po.get("reasoning", "Low stock levels detected"), - "consequence": po.get("consequence", "Order needed to maintain inventory levels"), + "reasoning": po.get("reasoning") or "Low stock levels detected", + "consequence": po.get("consequence") or "Order needed to maintain inventory levels", "amount": po.get("total_amount", 0), "currency": po.get("currency", "EUR"), "actions": [ @@ -393,14 +393,14 @@ class DashboardService: "id": f"onboarding_{step['id']}", "type": ActionType.COMPLETE_ONBOARDING, "urgency": ActionUrgency.IMPORTANT, - "title": step["title"], + "title": step.get("title") or "Complete onboarding step", "subtitle": "Setup incomplete", "reasoning": "Required to unlock full automation", - "consequence": step.get("consequence", "Some features are limited"), + "consequence": step.get("consequence") or "Some features are limited", "actions": [ {"label": "Complete Setup", "type": "primary", "action": "complete_onboarding"} ], - "estimatedTimeMinutes": step.get("estimated_minutes", 10) + "estimatedTimeMinutes": step.get("estimated_minutes") or 10 }) # Sort by urgency priority @@ -505,7 +505,7 @@ class DashboardService: "progress": progress, "readyBy": planned_end.isoformat() if planned_end else None, "priority": batch.get("priority", "MEDIUM"), - "reasoning": batch.get("reasoning", "Based on demand forecast") + "reasoning": batch.get("reasoning") or "Based on demand forecast" }) # Sort by planned start time