Skip to content

Commit 83b9b1b

Browse files
gcampclaude
andauthored
Fix operation rules logic for trip classification (#42)
- Update comment to clarify "stop times" instead of "stops" - Remove unnecessary previous_stop_type initialization check - Simplify logic by always checking consecutive region stops 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude <[email protected]>
1 parent 3c0c026 commit 83b9b1b

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

gtfs_flex_to_gofs_lite/files/operation_rules.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class StopType(Enum):
7777
# if it's a regular service, we keep it
7878
regular_service = True
7979
microtransit_only = True
80-
deviated_service = len(stop_times) > 2 # at least 3 stops, otherwise it's not a deviated service
80+
deviated_service = len(stop_times) > 2 # at least 3 stop times, otherwise it's not a deviated service
8181
previous_stop_type = None
8282

8383
for stop_time in stop_times:
@@ -87,12 +87,9 @@ class StopType(Enum):
8787
regular_service = False # either deviated or microtransit only
8888
else:
8989
microtransit_only = False
90-
91-
if previous_stop_type is None:
92-
previous_stop_type = StopType.REGION if is_a_region else StopType.STOP
93-
else:
94-
if previous_stop_type == StopType.REGION and is_a_region:
95-
deviated_service = False
90+
91+
if previous_stop_type == StopType.REGION and is_a_region:
92+
deviated_service = False
9693

9794
previous_stop_type = StopType.REGION if is_a_region else StopType.STOP
9895

0 commit comments

Comments
 (0)