feat: sort on load

This commit is contained in:
Vladimir Rubin 2024-12-25 17:47:53 +02:00
parent d9f13671d3
commit 6e7e799a82
Signed by: vavakado
GPG key ID: CAB744727F36B524

View file

@ -8,8 +8,8 @@ defmodule ExmrWeb.ExamLive.Index do
def mount(_params, _session, socket) do def mount(_params, _session, socket) do
socket = socket =
socket socket
|> assign(:exams, Exams.list_exams())
|> assign(:sort_by, "date") |> assign(:sort_by, "date")
|> assign(:exams, sort_items(Exams.list_exams(), "date"))
|> assign(:live_action, :index) |> assign(:live_action, :index)
|> assign(exam: %{}) |> assign(exam: %{})
|> assign(events: Enum.group_by(Exams.list_exams(), & &1.date)) |> assign(events: Enum.group_by(Exams.list_exams(), & &1.date))