Fix coast-to-coast trips and improve itinerary display
- Fix same-day different-city validation in C2C routes (no more impossible games like Detroit 7:30pm AND Milwaukee 8pm on the same day) - Cap C2C trips at 14 days max with 3 middle stops, prefer shortest routes - Add sport icon and name to game rows in trip itinerary - Add horizontal scroll to route dots in suggested trip cards - Allow swipe-to-dismiss on home sheet (trip planner still blocks) - Generate travel segments for suggested trips - Increase DAG route lookahead to 5 days for multi-day drives 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -33,8 +33,8 @@ enum GameDAGRouter {
|
||||
/// Buffer time after game ends before we can depart (hours)
|
||||
private static let gameEndBufferHours: Double = 3.0
|
||||
|
||||
/// Maximum days ahead to consider for next game (1 = next day only, 2 = allows one off-day)
|
||||
private static let maxDayLookahead = 2
|
||||
/// Maximum days ahead to consider for next game (1 = next day only, 5 = allows multi-day drives)
|
||||
private static let maxDayLookahead = 5
|
||||
|
||||
// MARK: - Public API
|
||||
|
||||
@@ -153,7 +153,14 @@ enum GameDAGRouter {
|
||||
// Step 6: Ensure geographic diversity in results
|
||||
// Group routes by their primary region (city with most games)
|
||||
// Then pick the best route from each region
|
||||
return selectDiverseRoutes(routesWithAnchors, stadiums: stadiums, maxCount: maxOptions)
|
||||
let finalRoutes = selectDiverseRoutes(routesWithAnchors, stadiums: stadiums, maxCount: maxOptions)
|
||||
|
||||
print("🔍 DAG: Input games=\(games.count), beam final=\(beam.count), withAnchors=\(routesWithAnchors.count), final=\(finalRoutes.count)")
|
||||
if let best = finalRoutes.first {
|
||||
print("🔍 DAG: Best route has \(best.count) games")
|
||||
}
|
||||
|
||||
return finalRoutes
|
||||
}
|
||||
|
||||
/// Compatibility wrapper that matches GeographicRouteExplorer's interface.
|
||||
@@ -215,7 +222,9 @@ enum GameDAGRouter {
|
||||
constraints: DrivingConstraints
|
||||
) -> Bool {
|
||||
// Time must move forward
|
||||
guard to.startTime > from.startTime else { return false }
|
||||
guard to.startTime > from.startTime else {
|
||||
return false
|
||||
}
|
||||
|
||||
// Same stadium = always feasible (no driving needed)
|
||||
if from.stadiumId == to.stadiumId { return true }
|
||||
@@ -224,6 +233,7 @@ enum GameDAGRouter {
|
||||
guard let fromStadium = stadiums[from.stadiumId],
|
||||
let toStadium = stadiums[to.stadiumId] else {
|
||||
// Missing stadium info - can't calculate distance, reject to be safe
|
||||
print("⚠️ DAG: Stadium lookup failed - from:\(stadiums[from.stadiumId] != nil) to:\(stadiums[to.stadiumId] != nil)")
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -264,10 +274,14 @@ enum GameDAGRouter {
|
||||
}
|
||||
|
||||
// Check if we have enough driving time
|
||||
guard drivingHours <= maxDrivingHoursAvailable else { return false }
|
||||
guard drivingHours <= maxDrivingHoursAvailable else {
|
||||
return false
|
||||
}
|
||||
|
||||
// Also verify we can arrive before game starts (sanity check)
|
||||
guard availableHours >= drivingHours else { return false }
|
||||
guard availableHours >= drivingHours else {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -97,6 +97,13 @@ final class ScenarioAPlanner: ScenarioPlanner {
|
||||
stopBuilder: buildStops
|
||||
)
|
||||
|
||||
print("🔍 ScenarioA: gamesInRange=\(gamesInRange.count), validRoutes=\(validRoutes.count)")
|
||||
if let firstRoute = validRoutes.first {
|
||||
print("🔍 ScenarioA: First route has \(firstRoute.count) games")
|
||||
let cities = firstRoute.compactMap { request.stadiums[$0.stadiumId]?.city }
|
||||
print("🔍 ScenarioA: Route cities: \(cities)")
|
||||
}
|
||||
|
||||
if validRoutes.isEmpty {
|
||||
return .failure(
|
||||
PlanningFailure(
|
||||
@@ -127,8 +134,14 @@ final class ScenarioAPlanner: ScenarioPlanner {
|
||||
routesAttempted += 1
|
||||
// Build stops for this route
|
||||
let stops = buildStops(from: routeGames, stadiums: request.stadiums)
|
||||
|
||||
// Debug: show stops created from games
|
||||
let stopCities = stops.map { "\($0.city)(\($0.games.count)g)" }
|
||||
print("🔍 ScenarioA: Route \(index) - \(routeGames.count) games → \(stops.count) stops: \(stopCities)")
|
||||
|
||||
guard !stops.isEmpty else {
|
||||
routesFailed += 1
|
||||
print("⚠️ ScenarioA: Route \(index) - buildStops returned empty")
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -139,6 +152,7 @@ final class ScenarioAPlanner: ScenarioPlanner {
|
||||
) else {
|
||||
// This route fails driving constraints, skip it
|
||||
routesFailed += 1
|
||||
print("⚠️ ScenarioA: Route \(index) - ItineraryBuilder.build failed")
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -178,12 +192,24 @@ final class ScenarioAPlanner: ScenarioPlanner {
|
||||
|
||||
// Sort and rank based on leisure level
|
||||
let leisureLevel = request.preferences.leisureLevel
|
||||
|
||||
// Debug: show all options before sorting
|
||||
print("🔍 ScenarioA: \(itineraryOptions.count) itinerary options before sorting:")
|
||||
for (i, opt) in itineraryOptions.enumerated() {
|
||||
print(" Option \(i): \(opt.stops.count) stops, \(opt.totalGames) games, \(String(format: "%.1f", opt.totalDrivingHours))h driving")
|
||||
}
|
||||
|
||||
let rankedOptions = ItineraryOption.sortByLeisure(
|
||||
itineraryOptions,
|
||||
leisureLevel: leisureLevel,
|
||||
limit: request.preferences.maxTripOptions
|
||||
)
|
||||
|
||||
print("🔍 ScenarioA: Returning \(rankedOptions.count) options after sorting (limit=\(request.preferences.maxTripOptions))")
|
||||
if let first = rankedOptions.first {
|
||||
print("🔍 ScenarioA: First option has \(first.stops.count) stops")
|
||||
}
|
||||
|
||||
return .success(rankedOptions)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user