Skip to content

Commit

Permalink
fix: always show route_pattern_prefix_overrides trips
Browse files Browse the repository at this point in the history
  • Loading branch information
nlwstein committed Oct 12, 2023
1 parent eb17e43 commit 8933b61
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
3 changes: 3 additions & 0 deletions apps/state/lib/state/helpers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ defmodule State.Helpers do
Application.compile_env(:state, :stops_on_route)[:route_pattern_prefix_overrides] do
def stops_on_route?(%Trip{route_pattern_id: unquote(route_pattern_id) <> _}),
do: unquote(include?)

def stops_on_route_by_shape?(%Trip{route_pattern_id: unquote(route_pattern_id) <> _}),
do: unquote(include?)
end

# Ignore alternate route trips and trips with a trip-specific route type
Expand Down
20 changes: 1 addition & 19 deletions apps/state/lib/state/stops_on_route.ex
Original file line number Diff line number Diff line change
Expand Up @@ -179,27 +179,9 @@ defmodule State.StopsOnRoute do
end)
|> Enum.flat_map(&do_gather_direction_group(route, global_stop_id_order, &1))

explicit_override_records = gather_explicit_overrides(route, direction_id)

shape_records
|> Enum.concat(other_records)
|> Enum.concat(explicit_override_records)
Enum.concat(shape_records, other_records)
end

defp gather_explicit_overrides(%{id: "Boat-F6"}, 1),
do: [
{"Boat-F6", 1, :all, "Boat-F6-Wdy-Smr-23", true,
["Boat-Winthrop", "Boat-Quincy", "Boat-Logan", "Boat-Fan", "Boat-Aquarium"]}
]

defp gather_explicit_overrides(%{id: "Boat-F6"}, 0),
do: [
{"Boat-F6", 0, :all, "Boat-F6-Wdy-Smr-23", true,
["Boat-Aquarium", "Boat-Fan", "Boat-Logan", "Boat-Quincy", "Boat-Winthrop"]}
]

defp gather_explicit_overrides(_, _), do: []

defp do_gather_direction_group(route, global_order, {group_key, trip_group}) do
{canonical?, shape_id, service_id, direction_id} = group_key

Expand Down

0 comments on commit 8933b61

Please sign in to comment.