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:
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user