Skip to content

Commit

Permalink
don't display predictions with skipped scheduled_relationship (#756)
Browse files Browse the repository at this point in the history
  • Loading branch information
panentheos authored May 29, 2024
1 parent d51ae32 commit 701677f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/signs/utilities/predictions.ex
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ defmodule Signs.Utilities.Predictions do
) do
predictions
|> Enum.filter(fn p ->
p.seconds_until_departure
p.seconds_until_departure && p.schedule_relationship != :skipped
end)
|> Enum.sort_by(fn prediction ->
{if terminal_prediction?(prediction, sources) do
Expand Down
9 changes: 6 additions & 3 deletions test/signs/realtime_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,12 @@ defmodule Signs.RealtimeTest do
Signs.Realtime.handle_info(:run_loop, @sign)
end

test "ignores predictions with no departure time" do
test "ignores predictions with no departure time or skipped schedule_relationship" do
expect(Engine.Predictions.Mock, :for_stop, fn _, _ ->
[prediction(destination: :alewife, seconds_until_departure: nil)]
[
prediction(destination: :alewife, seconds_until_departure: nil),
prediction(destination: :alewife, arrival: 1, schedule_relationship: :skipped)
]
end)

Signs.Realtime.handle_info(:run_loop, @sign)
Expand Down Expand Up @@ -1551,7 +1554,7 @@ defmodule Signs.RealtimeTest do
departure_certainty: Keyword.get(opts, :departure_certainty),
seconds_until_passthrough: Keyword.get(opts, :seconds_until_passthrough),
direction_id: Keyword.get(opts, :direction_id, 0),
schedule_relationship: nil,
schedule_relationship: Keyword.get(opts, :schedule_relationship),
route_id: Keyword.get(opts, :route_id),
trip_id: Keyword.get(opts, :trip_id, "123"),
destination_stop_id: Keyword.get(opts, :destination_stop_id),
Expand Down

0 comments on commit 701677f

Please sign in to comment.