Skip to content

Commit

Permalink
Merge pull request #237 from arup-group/fix-bug-236
Browse files Browse the repository at this point in the history
bugfix 236
  • Loading branch information
fredshone committed Jul 12, 2023
2 parents db721ae + bb2d8e2 commit 4d180c4
Show file tree
Hide file tree
Showing 4 changed files with 1,129 additions and 894 deletions.
2 changes: 1 addition & 1 deletion elara/event_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def vehicle_mode(self, vehicle_id: str) -> str:
:param vehicle_id: Vehicle ID string
:return: Vehicle mode type string
"""
if vehicle_id in self.resources['transit_schedule'].veh_to_mode_map.keys():
if self.resources['transit_schedule'].is_transit(vehicle_id=vehicle_id):
return self.resources['transit_schedule'].veh_to_mode_map[vehicle_id]
elif vehicle_id in self.resources['vehicles'].veh_to_mode_map:
return self.resources['vehicles'].veh_to_mode_map[vehicle_id]
Expand Down
9 changes: 9 additions & 0 deletions elara/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,15 @@ def build(

self.logger.debug(f'Transit Schedule Route modes = {self.modes}')
self.logger.debug(f'Transit Schedule Stop modes = {list(self.mode_to_stops_map)}')


def is_transit(self, vehicle_id: str) -> bool:
"""Given a vehicle's ID, return if it is a transit mode.
Based on existance in veh_to_mode_map.
:param vehicle_id: Vehicle ID string
:return: bool
"""
return vehicle_id in self.veh_to_mode_map

@staticmethod
def get_node_elem(elem):
Expand Down
Loading

0 comments on commit 4d180c4

Please sign in to comment.