feat: add sliding window trip generation for By Games mode
Adds a trip duration stepper (2-21 days) to the By Games planning mode. When users select specific games, the planner now generates ALL possible N-day windows containing those games (e.g., 7-day trips starting on different days), finding additional games in each window to maximize route options. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -221,13 +221,19 @@ final class ScenarioBPlanner: ScenarioPlanner {
|
||||
request: PlanningRequest
|
||||
) -> [DateInterval] {
|
||||
|
||||
// If explicit date range exists, use it
|
||||
if let dateRange = request.dateRange {
|
||||
// For gameFirst mode, ALWAYS use sliding windows with gameFirstTripDuration
|
||||
// This generates all possible N-day windows containing the selected games
|
||||
let isGameFirstMode = request.preferences.planningMode == .gameFirst
|
||||
let duration = isGameFirstMode
|
||||
? request.preferences.gameFirstTripDuration
|
||||
: request.preferences.effectiveTripDuration
|
||||
|
||||
// If not gameFirst and explicit date range exists, use it directly
|
||||
if !isGameFirstMode, let dateRange = request.dateRange {
|
||||
return [dateRange]
|
||||
}
|
||||
|
||||
// Otherwise, use trip duration to create sliding windows
|
||||
let duration = request.preferences.effectiveTripDuration
|
||||
// Use trip duration to create sliding windows
|
||||
guard duration > 0 else { return [] }
|
||||
|
||||
// Find the span of selected games
|
||||
|
||||
Reference in New Issue
Block a user