Skip to content

Commit

Permalink
Track recent departure for 90 minutes (#750)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulJKim authored May 9, 2024
1 parent 27bd645 commit f624835
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/engine/last_trip.ex
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ defmodule Engine.LastTrip do
|> Enum.each(fn {key, departures} ->
departures_within_last_hour =
Map.filter(departures, fn {_, departed_time} ->
DateTime.to_unix(current_time) - DateTime.to_unix(departed_time) <= @hour_in_seconds
DateTime.to_unix(current_time) - DateTime.to_unix(departed_time) <=
@hour_in_seconds * 1.5
end)

:ets.insert(state.recent_departures, {key, departures_within_last_hour})
Expand Down

0 comments on commit f624835

Please sign in to comment.