Skip to content

Commit

Permalink
Merge branch 'master' into elixir-1.17-otp-27
Browse files Browse the repository at this point in the history
  • Loading branch information
thbar authored Dec 12, 2024
2 parents 823f331 + 016bb01 commit 82df923
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ defmodule TransportWeb.Backoffice.ContactController do
end

defp columns_for_role(role) do
["is_#{role}" | Enum.map(Transport.NotificationReason.subscribable_reasons_for_role(role), &"#{role}_#{&1}")]
more_columns =
Transport.NotificationReason.subscribable_reasons_for_role(role)
|> Enum.map(&"#{role}_#{&1}")
|> Enum.sort()

["is_#{role}" | more_columns]
end

defp send_csv_response(chunks, filename, csv_header, %Plug.Conn{} = conn) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ defmodule TransportWeb.DatasetController do
data
|> Enum.reject(fn %DB.DatasetScore{score: score} -> is_nil(score) end)
|> Enum.group_by(fn %DB.DatasetScore{topic: topic} -> topic end)
# only keep "last" score + format for humans
|> Enum.map(fn {topic, scores} -> {topic, scores |> List.last() |> DB.DatasetScore.score_for_humans()} end)
|> Enum.sort_by(fn {a, _b} -> a end)
# make the order deterministic
|> Enum.sort_by(fn {topic, _score} -> topic end)

merge_assigns(conn, %{scores_chart: scores_chart, latest_scores: latest_scores})
end
Expand Down

0 comments on commit 82df923

Please sign in to comment.