diff --git a/lib/content/message/stopped_train.ex b/lib/content/message/stopped_train.ex index 78575bfbd..dcb73d2ac 100644 --- a/lib/content/message/stopped_train.ex +++ b/lib/content/message/stopped_train.ex @@ -13,12 +13,13 @@ defmodule Content.Message.StoppedTrain do require Logger @enforce_keys [:destination, :stops_away] - defstruct @enforce_keys ++ [:certainty] + defstruct @enforce_keys ++ [:certainty, :stop_id] @type t :: %__MODULE__{ destination: PaEss.destination(), stops_away: non_neg_integer(), - certainty: non_neg_integer() | nil + certainty: non_neg_integer() | nil, + stop_id: String.t() } @spec from_prediction(Predictions.Prediction.t()) :: t() | nil @@ -34,7 +35,8 @@ defmodule Content.Message.StoppedTrain do %__MODULE__{ destination: destination, stops_away: stops_away, - certainty: prediction.arrival_certainty || prediction.departure_certainty + certainty: prediction.arrival_certainty || prediction.departure_certainty, + stop_id: prediction.stop_id } {:error, _} -> diff --git a/lib/signs/utilities/early_am_suppression.ex b/lib/signs/utilities/early_am_suppression.ex index 061988a19..c9566acf2 100644 --- a/lib/signs/utilities/early_am_suppression.ex +++ b/lib/signs/utilities/early_am_suppression.ex @@ -166,6 +166,15 @@ defmodule Signs.Utilities.EarlyAmSuppression do {%Headways.Top{destination: destination, vehicle_type: :train}, %Headways.Bottom{range: range}} + # If we get one half of a headway message, it means the mz sign was showing headways in the original content generation + # but that one or the other mz lines has an early am status of :none. + # We can piece the original headway message back together in this case and let the proceeding logic handle what to do with it + {%Headways.Top{} = unprocessed_message, %Message.Empty{}} -> + {unprocessed_message, bottom_message} + + {%Headways.Bottom{} = unprocessed_message, %Message.Empty{}} -> + {top_message, unprocessed_message} + content -> content end @@ -189,7 +198,7 @@ defmodule Signs.Utilities.EarlyAmSuppression do }} status == :partially_suppressed -> - case filter_early_am_messages(messages, sign.id) do + case filter_early_am_messages(messages) do [] -> # If no valid predictions, try fetching headways case Signs.Utilities.Headways.get_messages(sign, current_time) do @@ -226,7 +235,7 @@ defmodule Signs.Utilities.EarlyAmSuppression do end end - defp filter_early_am_messages(messages, sign_id) do + defp filter_early_am_messages(messages) do Enum.reject(Tuple.to_list(messages), fn message -> case message do %Headways.Top{} -> @@ -246,8 +255,9 @@ defmodule Signs.Utilities.EarlyAmSuppression do _ -> false end + # Reject reverse predictions/stopped trains unless the message is for Prudential or Symphony EB is_prediction_or_stopped? and message.certainty == @reverse_prediction_certainty and - sign_id not in ["symphony_eastbound", "prudential_eastbound"] + message.stop_id not in ["70240", "70242"] end end) end diff --git a/priv/signs.json b/priv/signs.json index 284043858..55438c1aa 100644 --- a/priv/signs.json +++ b/priv/signs.json @@ -6365,7 +6365,7 @@ ], "type": "realtime", "source_config": { - "headway_group": "green_trunk", + "headway_group": "green_b", "headway_direction_name": "Eastbound", "sources": [ { @@ -6394,8 +6394,8 @@ ], "type": "realtime", "source_config": { - "headway_group": "green_trunk", - "headway_direction_name": "Westbound", + "headway_group": "green_b", + "headway_direction_name": "Boston College", "sources": [ { "stop_id": "71151",