Add missing index to records table

Updates a relevant test to remove flakyness
This commit is contained in:
Claudio Ortolina
2024-10-22 22:15:13 +01:00
parent 65a6bbbea9
commit 79edd6eade
2 changed files with 10 additions and 1 deletions
@@ -50,7 +50,9 @@ defmodule MusicLibraryWeb.StatsControllerTest do
end
test "it shows the latest purchase", %{conn: conn, collection: collection} do
latest_record = Enum.max_by(collection, & &1.purchased_at)
# purchased_at has second precision, so finding the latest purchased using then
# highest purchsed_at value doesn't work, as it picks the wrong value.
latest_record = List.last(collection)
conn = get(conn, "/")