feat: improve planning engine travel handling, itinerary reordering, and scenario planners
Add TravelInfo initializers and city normalization helpers to fix repeat city-pair disambiguation. Improve drag-and-drop reordering with segment index tracking and source-row-aware zone calculation. Enhance all five scenario planners with better next-day departure handling and travel segment placement. Add comprehensive tests across all planners. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -75,6 +75,26 @@ final class ScenarioBPlanner: ScenarioPlanner {
|
||||
)
|
||||
}
|
||||
|
||||
// In explicit date-range mode, fail fast if selected anchors are out of range.
|
||||
let isGameFirstMode = request.preferences.planningMode == .gameFirst
|
||||
if !isGameFirstMode, let explicitRange = request.dateRange {
|
||||
let outOfRangeAnchors = selectedGames.filter { !explicitRange.contains($0.startTime) }
|
||||
if !outOfRangeAnchors.isEmpty {
|
||||
return .failure(
|
||||
PlanningFailure(
|
||||
reason: .dateRangeViolation(games: outOfRangeAnchors),
|
||||
violations: [
|
||||
ConstraintViolation(
|
||||
type: .dateRange,
|
||||
description: "\(outOfRangeAnchors.count) selected game(s) are outside the requested date range",
|
||||
severity: .error
|
||||
)
|
||||
]
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// ──────────────────────────────────────────────────────────────────
|
||||
// Step 2: Generate date ranges (sliding window or single range)
|
||||
// ──────────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user