Skip to content

Commit

Permalink
fix: Need to query the table in order of latest updates (#2781)
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahpurcell authored Sep 10, 2024
1 parent acef897 commit e51917e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/skate/detours/detours.ex
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@ defmodule Skate.Detours.Detours do
"""
def grouped_detours(user_id) do
detours =
Detour
|> Repo.all()
Repo.all(
from(d in Detour,
order_by: [desc: d.updated_at]
)
)
|> Enum.map(fn detour -> db_detour_to_detour(detour, user_id) end)
|> Enum.filter(& &1)
|> Enum.group_by(fn detour -> detour.status end)
Expand Down

0 comments on commit e51917e

Please sign in to comment.