Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use "Southbound" for Red Line non revenue trains #872

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/content/audio/passthrough.ex
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ defmodule Content.Audio.Passthrough do

@spec destination_var(PaEss.destination(), String.t()) :: String.t() | nil
defp destination_var(:alewife, _route_id), do: "32114"
defp destination_var(:ashmont, "Red"), do: "32117"
defp destination_var(:braintree, _route_id), do: "32118"
defp destination_var(:southbound, "Red"), do: "891"
defp destination_var(:bowdoin, _route_id), do: "32111"
defp destination_var(:wonderland, _route_id), do: "32110"
defp destination_var(:forest_hills, _route_id), do: "32113"
Expand Down
6 changes: 3 additions & 3 deletions lib/signs/utilities/predictions.ex
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ defmodule Signs.Utilities.Predictions do
|> Enum.sort_by(fn prediction -> prediction.seconds_until_passthrough end)
|> Enum.flat_map(fn prediction ->
destination =
case Content.Utilities.destination_for_prediction(prediction) do
:southbound -> :ashmont
destination -> destination
case prediction do
%{route_id: "Red", direction_id: 0} -> :southbound
_ -> Content.Utilities.destination_for_prediction(prediction)
end

[
Expand Down
27 changes: 15 additions & 12 deletions test/signs/realtime_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,12 @@ defmodule Signs.RealtimeTest do
]
end)

expect_audios([{:canned, {"103", ["32118"], :audio_visual}}], [
{"The next Braintree train does not take customers. Please stand back from the yellow line.",
expect_audios([{:canned, {"103", ["891"], :audio_visual}}], [
{"The next Southbound train does not take customers. Please stand back from the yellow line.",
[
{"The next Braintree train", "does not take customers.", 3},
{"Please stand back from", "the yellow line.", 3}
{"The next Southbound", "train does not take", 3},
{"customers. Please stand", "back from the yellow", 3},
{"line.", "", 3}
]}
])

Expand All @@ -196,11 +197,12 @@ defmodule Signs.RealtimeTest do
[prediction(destination: :alewife, seconds_until_passthrough: 30, trip_id: "124")]
end)

expect_audios([{:canned, {"103", ["32118"], :audio_visual}}], [
{"The next Braintree train does not take customers. Please stand back from the yellow line.",
expect_audios([{:canned, {"103", ["891"], :audio_visual}}], [
{"The next Southbound train does not take customers. Please stand back from the yellow line.",
[
{"The next Braintree train", "does not take customers.", 3},
{"Please stand back from", "the yellow line.", 3}
{"The next Southbound", "train does not take", 3},
{"customers. Please stand", "back from the yellow", 3},
{"line.", "", 3}
]}
])

Expand All @@ -220,11 +222,12 @@ defmodule Signs.RealtimeTest do
[prediction(destination: :southbound, seconds_until_passthrough: 30)]
end)

expect_audios([{:canned, {"103", ["32117"], :audio_visual}}], [
{"The next Ashmont train does not take customers. Please stand back from the yellow line.",
expect_audios([{:canned, {"103", ["891"], :audio_visual}}], [
{"The next Southbound train does not take customers. Please stand back from the yellow line.",
[
{"The next Ashmont train", "does not take customers.", 3},
{"Please stand back from", "the yellow line.", 3}
{"The next Southbound", "train does not take", 3},
{"customers. Please stand", "back from the yellow", 3},
{"line.", "", 3}
]}
])

Expand Down
Loading