fix: preserve LocationSearchSheet coordinates in By Route mode

The resolveLocations() function was overwriting valid LocationInput
objects (with coordinates) from LocationSearchSheet. Now it only
resolves locations that don't already have coordinates.

Added debug logging to trace scenario selection.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-01-11 18:59:44 -06:00
parent 1967eecd52
commit 3f80a16201
2 changed files with 31 additions and 2 deletions

View File

@@ -22,22 +22,32 @@ enum ScenarioPlannerFactory {
/// Creates the appropriate planner based on the request inputs
static func planner(for request: PlanningRequest) -> ScenarioPlanner {
print("🔍 ScenarioPlannerFactory: Selecting planner...")
print(" - followTeamId: \(request.preferences.followTeamId?.uuidString ?? "nil")")
print(" - selectedGames.count: \(request.selectedGames.count)")
print(" - startLocation: \(request.startLocation?.name ?? "nil")")
print(" - endLocation: \(request.endLocation?.name ?? "nil")")
// Scenario D: User wants to follow a specific team
if request.preferences.followTeamId != nil {
print("🔍 ScenarioPlannerFactory: → ScenarioDPlanner (follow team)")
return ScenarioDPlanner()
}
// Scenario B: User selected specific games
if !request.selectedGames.isEmpty {
print("🔍 ScenarioPlannerFactory: → ScenarioBPlanner (selected games)")
return ScenarioBPlanner()
}
// Scenario C: User specified start and end locations
if request.startLocation != nil && request.endLocation != nil {
print("🔍 ScenarioPlannerFactory: → ScenarioCPlanner (start/end locations)")
return ScenarioCPlanner()
}
// Scenario A: Date range only (default)
print("🔍 ScenarioPlannerFactory: → ScenarioAPlanner (default/date range)")
return ScenarioAPlanner()
}