Refactor travel segments and simplify trip options
Travel segment architecture: - Remove departureTime/arrivalTime from TravelSegment (location-based, not date-based) - Fix travel sections appearing after destination instead of between cities - Fix missing travel segments when revisiting same city (consecutive grouping) - Remove unwanted rest day at end of trip Planning engine fixes: - All three planners now group only consecutive games at same stadium - Visiting A → B → A creates 3 stops with proper travel between UI simplification: - Remove redundant sort options (mostDriving/leastDriving, mostCities/leastCities) - Remove unused "Find Other Sports Along Route" toggle (was dead code) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1794,45 +1794,9 @@ struct ScenarioCPlannerTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test("Departure time before arrival time")
|
||||
func plan_DepartureBeforeArrival() {
|
||||
let planner = ScenarioCPlanner()
|
||||
let sd = sdStadium
|
||||
let la = laStadium
|
||||
let sf = sfStadium
|
||||
|
||||
let game = makeGame(stadiumId: la.id, date: date("2026-06-10 19:00"))
|
||||
|
||||
let startLoc = LocationInput(
|
||||
name: "San Diego",
|
||||
coordinate: CLLocationCoordinate2D(latitude: sd.latitude, longitude: sd.longitude)
|
||||
)
|
||||
let endLoc = LocationInput(
|
||||
name: "San Francisco",
|
||||
coordinate: CLLocationCoordinate2D(latitude: sf.latitude, longitude: sf.longitude)
|
||||
)
|
||||
|
||||
let request = makeRequest(
|
||||
games: [game],
|
||||
stadiums: [sd.id: sd, la.id: la, sf.id: sf],
|
||||
startLocation: startLoc,
|
||||
endLocation: endLoc,
|
||||
startDate: date("2026-06-01 00:00"),
|
||||
endDate: date("2026-06-30 23:59")
|
||||
)
|
||||
|
||||
let result = planner.plan(request: request)
|
||||
|
||||
if case .success(let options) = result {
|
||||
for option in options {
|
||||
for segment in option.travelSegments {
|
||||
#expect(segment.departureTime < segment.arrivalTime)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Issue.record("Expected success")
|
||||
}
|
||||
}
|
||||
// Note: "Departure time before arrival time" test removed
|
||||
// Travel segments are now location-based, not time-based
|
||||
// The user decides when to travel; segments only describe route info
|
||||
|
||||
@Test("Games filtered to date range")
|
||||
func plan_GamesFilteredToDateRange() {
|
||||
|
||||
Reference in New Issue
Block a user