Skip to content

Commit

Permalink
Fix filter, filter and unnecessary use of apply (#2106)
Browse files Browse the repository at this point in the history
* fix filter, filter and unnecessary use of apply

* arg isnt a list
  • Loading branch information
anthonyshull authored Jun 24, 2024
1 parent aad62bb commit bc69125
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/alerts/historical_alert.ex
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ defmodule Alerts.HistoricalAlert do
:stop -> @stops_repo
end

case apply(module, :get, [id]) do
case module.get(id) do
%{name: name} when not is_nil(name) -> name
_ -> id
end
Expand Down
3 changes: 1 addition & 2 deletions lib/predictions/stream.ex
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ defmodule Predictions.Stream do

defp to_predictions(%JsonApi{data: data}) do
data
|> Enum.filter(&(&1.type == "prediction"))
|> Enum.filter(&Repo.has_trip?/1)
|> Enum.filter(&(&1.type == "prediction" && Repo.has_trip?(&1)))
|> Enum.map(&StreamParser.parse/1)
end

Expand Down

0 comments on commit bc69125

Please sign in to comment.