Skip to content

Commit

Permalink
chore: suppress alert 590467 on pre-fare screens
Browse files Browse the repository at this point in the history
Alert #590467 represents suspension of red line service on the Braintree
branch with shuttles connecting at Ashmont instead of JFK/UMass. Because
of this abnormal shuttle pattern, the generated line maps will not be
accurate. Evergreen content will be used to display the correct
information to riders.
  • Loading branch information
sloanelybutsurely committed Aug 28, 2024
1 parent 0180877 commit 3793cde
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/screens/v2/widget_instance/reconstructed_alert.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1313,10 +1313,11 @@ defmodule Screens.V2.WidgetInstance.ReconstructedAlert do

def alert_ids(%__MODULE__{} = t), do: [t.alert.id]

def valid_candidate?(%__MODULE__{} = t) do
test_alert_ids = ["197140"]
prod_alert_ids = ["580015"]
t.alert.id not in (test_alert_ids ++ prod_alert_ids)
@test_alert_ids ~w[197140]
@prod_alert_ids ~w[580015 590467]

def valid_candidate?(%__MODULE__{alert: %{id: alert_id}}) do
alert_id not in @test_alert_ids and alert_id not in @prod_alert_ids
end

defimpl Screens.V2.WidgetInstance do
Expand Down
21 changes: 21 additions & 0 deletions test/screens/v2/widget_instance/reconstructed_alert_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ defmodule Screens.V2.WidgetInstance.ReconstructedAlertTest do
%{widget | alert: %{widget.alert | header: header}}
end

defp put_alert_id(widget, id) do
%{widget | alert: %{widget.alert | id: id}}
end

defp put_severity(widget, severity) do
%{widget | alert: %{widget.alert | severity: severity}}
end
Expand Down Expand Up @@ -3172,4 +3176,21 @@ defmodule Screens.V2.WidgetInstance.ReconstructedAlertTest do
)
end
end

describe "valid_candidate?/1" do
test "returns true", %{widget: widget} do
assert WidgetInstance.valid_candidate?(widget)
end

suppressed_alerts = ~w[197140 580015 590467]

for alert_id <- suppressed_alerts do
@tag alert_id: alert_id
test "returns false for alert ##{alert_id}", %{widget: widget, alert_id: alert_id} do
refute widget
|> put_alert_id(alert_id)
|> WidgetInstance.valid_candidate?()
end
end
end
end

0 comments on commit 3793cde

Please sign in to comment.