feat(planning): add trip filtering and fix departure date logic
- Add Trip.status property for status tracking - Add RouteFilters trip list methods (filterBySport, filterByDateRange, filterByStatus, applyFilters) - Add TravelEstimator max driving hours validation - Fix ScenarioA/B departureDate to use last game day (not day after) - Update GameDAGRouter comments for buffer logic Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,7 +20,7 @@ enum TravelEstimator {
|
||||
// MARK: - Travel Estimation
|
||||
|
||||
/// Estimates a travel segment between two stops.
|
||||
/// Always creates a segment - feasibility is checked by GameDAGRouter.
|
||||
/// Returns nil if trip exceeds maximum allowed driving hours (2 days worth).
|
||||
static func estimate(
|
||||
from: ItineraryStop,
|
||||
to: ItineraryStop,
|
||||
@@ -30,6 +30,12 @@ enum TravelEstimator {
|
||||
let distanceMiles = calculateDistanceMiles(from: from, to: to)
|
||||
let drivingHours = distanceMiles / averageSpeedMph
|
||||
|
||||
// Maximum allowed: 2 days of driving
|
||||
let maxAllowedHours = constraints.maxDailyDrivingHours * 2.0
|
||||
if drivingHours > maxAllowedHours {
|
||||
return nil
|
||||
}
|
||||
|
||||
return TravelSegment(
|
||||
fromLocation: from.location,
|
||||
toLocation: to.location,
|
||||
@@ -40,7 +46,7 @@ enum TravelEstimator {
|
||||
}
|
||||
|
||||
/// Estimates a travel segment between two LocationInputs.
|
||||
/// Returns nil only if coordinates are missing.
|
||||
/// Returns nil if coordinates are missing or if trip exceeds maximum allowed driving hours (2 days worth).
|
||||
static func estimate(
|
||||
from: LocationInput,
|
||||
to: LocationInput,
|
||||
@@ -56,6 +62,12 @@ enum TravelEstimator {
|
||||
let distanceMiles = distanceMeters * 0.000621371 * roadRoutingFactor
|
||||
let drivingHours = distanceMiles / averageSpeedMph
|
||||
|
||||
// Maximum allowed: 2 days of driving
|
||||
let maxAllowedHours = constraints.maxDailyDrivingHours * 2.0
|
||||
if drivingHours > maxAllowedHours {
|
||||
return nil
|
||||
}
|
||||
|
||||
return TravelSegment(
|
||||
fromLocation: from,
|
||||
toLocation: to,
|
||||
|
||||
Reference in New Issue
Block a user