Skip to content

Commit

Permalink
Order of map operations changed in OTP26
Browse files Browse the repository at this point in the history
  • Loading branch information
vdegove committed Mar 19, 2024
1 parent f583cd2 commit b68c1c1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ defmodule Datagouvfr.Client.DiscussionTest do
{"content-type", "application/json"}
]

assert body == ~s({"comment":"#{comment}","subject":{"class":"Dataset","id":"#{datagouv_id}"},"title":"#{title}"})
assert body == ~s({"title":"#{title}","comment":"#{comment}","subject":{"id":"#{datagouv_id}","class":"Dataset"}})
json(%{"title" => title, "discussion" => [%{"content" => comment}]}, status: 201)
end)

Expand Down
2 changes: 1 addition & 1 deletion apps/shared/test/validation/gbfs_validator_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ defmodule GBFSValidatorTest do

test "can encode summary" do
assert """
{"errors_count":0,"has_errors":false,"validator":"validator_module","validator_version":"31c5325","version_detected":"1.1","version_validated":"1.1"}\
{"validator":"validator_module","errors_count":0,"has_errors":false,"version_detected":"1.1","version_validated":"1.1","validator_version":"31c5325"}\
""" ==
Jason.encode!(%Summary{
errors_count: 0,
Expand Down
10 changes: 8 additions & 2 deletions apps/transport/lib/jobs/gtfs_rt_metadata.ex
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,16 @@ defmodule Transport.Jobs.GTFSRTMetadataJob do
iex> present_entities(%{service_alerts: 0, vehicle_positions: 1})
["vehicle_positions"]
iex> present_entities(%{service_alerts: 2, vehicle_positions: 1})
["service_alerts", "vehicle_positions"]
["vehicle_positions", "service_alerts"]
"""
def present_entities(count_entities) do
count_entities |> Map.filter(fn {_, v} -> v > 0 end) |> Enum.map(fn {k, _} -> Atom.to_string(k) end)
Enum.flat_map(count_entities, fn {k, v} ->
if v > 0 do
[Atom.to_string(k)]
else
[]
end
end)
end

@spec process_feed({:error, any} | {:ok, TransitRealtime.FeedMessage.t()}, DB.Resource.t()) :: any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,8 @@ defmodule TransportWeb.DatasetControllerTest do
assert [
{"table", [{"class", "table"}],
[
{"tr", [], [{"th", [], ["Conformité"]}, {"th", [], ["Fraicheur"]}]},
{"tr", [], [{"td", [], ["80%"]}, {"td", [], ["55%"]}]}
{"tr", [], [{"th", [], ["Fraicheur"]}, {"th", [], ["Conformité"]}]},
{"tr", [], [{"td", [], ["55%"]}, {"td", [], ["80%"]}]}
]}
] == content |> Floki.find("#quality-indicators table")
end
Expand Down

0 comments on commit b68c1c1

Please sign in to comment.