Skip to content

Commit

Permalink
fix date sorting using timex (#2151)
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyshull authored Aug 19, 2024
1 parent fd52ba8 commit 3265e1b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/alerts/repo.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ defmodule Alerts.Repo do
|> by_route_ids(now)
|> Enum.filter(&Alert.diversion?/1)
|> Enum.sort(fn a, b ->
a.active_period |> List.first() |> elem(0) < b.active_period |> List.first() |> elem(0)
first = a.active_period |> List.first() |> elem(0)
second = b.active_period |> List.first() |> elem(0)

Timex.before?(first, second)
end)
end

Expand Down

0 comments on commit 3265e1b

Please sign in to comment.