Skip to content

Commit 8ba3a0e

Browse files
committed
fix: use the Route.type instead of trip.route_type to determine if added trip is subway
1 parent e0bd765 commit 8ba3a0e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

apps/state/lib/state/trip/added.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,11 @@ defmodule State.Trip.Added do
5555
defp prediction_to_trip({trip_id, prediction}) do
5656
with %{route_pattern_id: route_pattern_id} when is_binary(route_pattern_id) <- prediction,
5757
%{representative_trip_id: rep_trip_id} <- State.RoutePattern.by_id(route_pattern_id),
58-
[trip | _] <- State.Trip.by_id(rep_trip_id) do
58+
[trip | _] <- State.Trip.by_id(rep_trip_id),
59+
%Route{} = route <- State.Route.by_id(prediction.route_id) do
5960
stop = parent_or_stop(prediction.stop_id)
6061

61-
headsign = if stop && subway?(trip.route_type), do: stop.name, else: trip.headsign
62+
headsign = if stop && subway?(route), do: stop.name, else: trip.headsign
6263

6364
[
6465
%{

0 commit comments

Comments
 (0)