Skip to content

Commit

Permalink
Make @latest_scores order determinist
Browse files Browse the repository at this point in the history
This fix a broken test and ensure the view rendering is also deterministic.
  • Loading branch information
thbar committed Nov 28, 2024
1 parent 2a7eb40 commit 6075516
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ 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)
|> Map.new(fn {topic, scores} -> {topic, scores |> List.last() |> DB.DatasetScore.score_for_humans()} end)
|> Enum.map(fn {topic, scores} -> {topic, scores |> List.last() |> DB.DatasetScore.score_for_humans()} end)
|> Enum.sort_by(fn {a, _b} -> a end)

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

0 comments on commit 6075516

Please sign in to comment.