fix(planning): gameFirst mode now uses full date range and shows correct month
Two bugs fixed in "By Games" trip planning mode: 1. Calendar navigation: DateRangePicker now navigates to the selected game's month when startDate changes externally, instead of staying on the current month. 2. Date range calculation: Fixed race condition where date range was calculated before games were loaded. Now updateDateRangeForSelectedGames() is called after loadSummaryGames() completes. 3. Bonus games: planTrip() now uses the UI-selected 7-day date range instead of overriding it with just the anchor game dates. This allows ScenarioBPlanner to find additional games within the trip window. Added regression tests to verify gameFirst mode includes bonus games. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -77,11 +77,6 @@ struct GamePickerStep: View {
|
||||
}
|
||||
.padding(Theme.Spacing.lg)
|
||||
.background(Theme.cardBackground(colorScheme))
|
||||
.onChange(of: selectedGameIds) { _, newValue in
|
||||
Task {
|
||||
await updateDateRangeForSelectedGames()
|
||||
}
|
||||
}
|
||||
.clipShape(RoundedRectangle(cornerRadius: Theme.CornerRadius.large))
|
||||
.overlay {
|
||||
RoundedRectangle(cornerRadius: Theme.CornerRadius.large)
|
||||
@@ -230,6 +225,8 @@ struct GamePickerStep: View {
|
||||
await MainActor.run {
|
||||
summaryGames = Array(Set(games))
|
||||
}
|
||||
// Update date range after games are loaded (not before)
|
||||
await updateDateRangeForSelectedGames()
|
||||
}
|
||||
|
||||
// MARK: - Date Range Section
|
||||
|
||||
Reference in New Issue
Block a user