fix: Add missing reasoning field to production timeline items

ProductionTimelineItem schema requires a 'reasoning' field (string), but the
dashboard service was only providing 'reasoning_data'. Added the reasoning
text field with fallback to auto-generated text if not present in batch data.

Fixes Pydantic validation error: 'Field required' for reasoning field.
This commit is contained in:
Claude
2025-11-08 07:47:11 +00:00
parent 232ef80a6e
commit f491cd4df5

View File

@@ -525,6 +525,7 @@ class DashboardService:
"progress": progress, "progress": progress,
"readyBy": planned_end.isoformat() if planned_end else None, "readyBy": planned_end.isoformat() if planned_end else None,
"priority": batch.get("priority", "MEDIUM"), "priority": batch.get("priority", "MEDIUM"),
"reasoning": batch.get("reasoning") or f"Scheduled based on {reasoning_data.get('type', 'forecast demand')}", # Fallback reasoning text
"reasoning_data": reasoning_data # NEW: Structured data for i18n "reasoning_data": reasoning_data # NEW: Structured data for i18n
}) })