Skip to content

Commit

Permalink
hotfix(SiteWeb.AlertView): remove 2nd Ashmont alert
Browse files Browse the repository at this point in the history
  • Loading branch information
thecristen committed Oct 18, 2023
1 parent 405df60 commit efb904b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions apps/site/lib/site_web/views/alert_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ defmodule SiteWeb.AlertView do
opts
|> Keyword.fetch!(:alerts)
|> Enum.filter(&filter_by_priority(priority_filter, &1))
|> deduplicate()

case {alerts, show_empty?} do
{[], true} ->
Expand All @@ -43,6 +44,19 @@ defmodule SiteWeb.AlertView do
end
end

# Workaround handling duplicate Red Line alerts for JFK-Ashmont shuttle
defp deduplicate(alerts) do
alert_ids = Enum.map(alerts, & &1.id)
ashmont_shuttle_alert_ids = ["519314", "529291"]

if Enum.all?(ashmont_shuttle_alert_ids, &Enum.member?(alert_ids, &1)) do
# remove the second one
Enum.reject(alerts, &(&1.id == "529291"))
else
alerts
end
end

@spec no_alerts_message(map, boolean, atom) :: iolist
def no_alerts_message(route, false, :current) do
[
Expand Down

0 comments on commit efb904b

Please sign in to comment.