Skip to content

Commit

Permalink
Look at routes instead of ID for SL.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaddox5 committed Jun 21, 2024
1 parent b775f28 commit ee1ee63
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/signs/bus.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ defmodule Signs.Bus do
@drawbridge_minutes_spanish "152"
@drawbridge_soon_spanish "157"
@alert_levels [:station_closure, :suspension_closed_station]
@sl_route_ids MapSet.new(["741", "742", "743", "746"])

@enforce_keys [
:id,
Expand Down Expand Up @@ -140,9 +141,10 @@ defmodule Signs.Bus do
bridge_enabled? = config_engine.chelsea_bridge_config() == :auto
bridge_status = bridge_engine.bridge_status()
current_time = Timex.now()
all_route_ids = all_route_ids(state)

route_alerts_lookup =
for route_id <- all_route_ids(state), into: %{} do
for route_id <- all_route_ids, into: %{} do
{route_id, alerts_engine.route_status(route_id)}
end

Expand All @@ -167,7 +169,7 @@ defmodule Signs.Bus do
# Compute new sign text and audio
{[top, bottom], audios} =
cond do
config_off?(id, config) ->
config_off?(config, all_route_ids) ->
{["", ""], []}

match?({:static_text, _}, config) ->
Expand Down Expand Up @@ -843,7 +845,9 @@ defmodule Signs.Bus do
end

# If a Silver Line sign is in headway mode, SignsUI will flag its predictions but RTS needs to treat it as off
defp config_off?("Silver_Line." <> _, :headway), do: true
defp config_off?(_, :off), do: true
defp config_off?(:headway, route_ids),
do: route_ids |> MapSet.new() |> MapSet.subset?(@sl_route_ids)

defp config_off?(:off, _), do: true
defp config_off?(_, _), do: false
end

0 comments on commit ee1ee63

Please sign in to comment.