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

Don't page no service message on MZ signs #752

Merged
merged 1 commit into from
May 10, 2024
Merged
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
26 changes: 10 additions & 16 deletions lib/content/message/last_trip/no_service.ex
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
defmodule Content.Message.LastTrip.NoService do
@enforce_keys [:destination, :page?]
@enforce_keys [:destination, :line]
defstruct @enforce_keys

@type t :: %__MODULE__{
destination: PaEss.destination(),
page?: boolean()
line: :top | :bottom
}

defimpl Content.Message do
def to_string(%Content.Message.LastTrip.NoService{
destination: destination,
page?: page?
line: line
}) do
headsign = PaEss.Utilities.destination_to_sign_string(destination)

if page?,
do: [
{Content.Utilities.width_padded_string(
headsign,
"No trains",
24
), 6},
{Content.Utilities.width_padded_string(
headsign,
"Svc ended",
24
), 6}
],
if line == :bottom,
do:
Content.Utilities.width_padded_string(
headsign,
"Svc ended",
24
),
else:
Content.Utilities.width_padded_string(
headsign,
Expand Down
8 changes: 4 additions & 4 deletions lib/signs/utilities/last_trip.ex
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ defmodule Signs.Utilities.LastTrip do
{unpacked_mz_bottom,
%Content.Message.LastTrip.NoService{
destination: top_source.headway_destination,
page?: true
line: :bottom
}}
else
{%Content.Message.LastTrip.NoService{
destination: top_source.headway_destination,
page?: false
line: :top
}, unpacked_mz_bottom}
end

Expand All @@ -49,12 +49,12 @@ defmodule Signs.Utilities.LastTrip do
{unpacked_mz_top,
%Content.Message.LastTrip.NoService{
destination: bottom_source.headway_destination,
page?: true
line: :bottom
}}
else
{%Content.Message.LastTrip.NoService{
destination: bottom_source.headway_destination,
page?: false
line: :top
}, unpacked_mz_top}
end

Expand Down
2 changes: 1 addition & 1 deletion test/signs/realtime_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -1426,7 +1426,7 @@ defmodule Signs.RealtimeTest do

expect_messages(
{[{"Mattapan Stopped", 6}, {"Mattapan 8 stops", 6}, {"Mattapan away", 6}],
[{"Southbound No trains", 6}, {"Southbound Svc ended", 6}]}
"Southbound Svc ended"}
)

expect_audios([
Expand Down
Loading