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:
Trey t
2026-01-09 11:42:27 -06:00
parent 7efcea7bd4
commit 3e778473e6
7 changed files with 531 additions and 120 deletions

View File

@@ -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
}