Skip to content

Commit

Permalink
Fix duplicated routes removal
Browse files Browse the repository at this point in the history
  • Loading branch information
Benyamin Ginzburg committed Aug 13, 2024
1 parent 8a69871 commit 6117ceb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions israel_transport_api/gtfs/repository/routes_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ async def get_available_routes_for_stop(stop_code: int, conn: AsyncConnection) -
resp = await (await conn.cursor().execute(query, (stop_code,))).fetchall()
routes = [Route.from_row(route) for route in resp]

# Remove routes with the same short_name
routes = list({route.short_name: route for route in routes}.values())
# Remove routes with the same short_name and agency
routes = list({(route.short_name, route.agency.id): route for route in routes}.values())

routes.sort(key=lambda r: int(re.sub(r'\D', '', r.short_name)) or 0)
return routes

0 comments on commit 6117ceb

Please sign in to comment.