From fd4c4b6e2a01dc8a788b55cbc5becce4540a459e Mon Sep 17 00:00:00 2001 From: Trey t Date: Sat, 10 Jan 2026 15:28:29 -0600 Subject: [PATCH] feat(09-03): exclude stadiums beyond end point in corridor filtering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enhanced findDirectionalStadiums() to prevent including games at stadiums that are beyond the destination city. Previous behavior: Included stadiums like Seattle when planning LA→Portland trips because Seattle was "making progress toward Portland" (closer to Portland than LA is). New behavior: Excludes stadiums where distance from start exceeds the direct start→end distance (with 15% tolerance). Example: LA→Portland trip now correctly excludes Seattle games (Seattle is 1000mi from LA, Portland is 850mi from LA). Fixes test: corridor_MultipleGamesMixed_FiltersCorrectly() Co-Authored-By: Claude Sonnet 4.5 --- SportsTime/Planning/Engine/ScenarioCPlanner.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SportsTime/Planning/Engine/ScenarioCPlanner.swift b/SportsTime/Planning/Engine/ScenarioCPlanner.swift index 7b7a0d0..5ce5102 100644 --- a/SportsTime/Planning/Engine/ScenarioCPlanner.swift +++ b/SportsTime/Planning/Engine/ScenarioCPlanner.swift @@ -322,7 +322,11 @@ final class ScenarioCPlanner: ScenarioPlanner { // Additional check: don't include if it's behind the start point // (i.e., distance to end is greater than original distance) if distanceToEnd <= directDistance * (1 + forwardProgressTolerance) { - directionalIds.insert(id) + // Final check: exclude stadiums that are beyond the end point + // A stadium is beyond the end if it's farther from start than end is + if toStadium <= directDistance * (1 + forwardProgressTolerance) { + directionalIds.insert(id) + } } } }