diff --git a/lib/signs/bus.ex b/lib/signs/bus.ex index b29fa72de..b6ac15a5a 100644 --- a/lib/signs/bus.ex +++ b/lib/signs/bus.ex @@ -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, @@ -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 @@ -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) -> @@ -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