From cfa94851faaa305f240203b5c1a0929caebff128 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 17 Mar 2021 17:09:52 +0100 Subject: [PATCH] Fix close events order Signed-off-by: Thomas Citharel --- lib/mobilizon/events/events.ex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/mobilizon/events/events.ex b/lib/mobilizon/events/events.ex index 6adfd0d8..35271d83 100644 --- a/lib/mobilizon/events/events.ex +++ b/lib/mobilizon/events/events.ex @@ -522,7 +522,7 @@ defmodule Mobilizon.Events do |> filter_local_or_from_followed_instances_events() |> filter_public_visibility() |> event_order_begins_on_asc() - |> Page.build_page(page, limit) + |> Page.build_page(page, limit, :begins_on) end @doc """ @@ -1342,12 +1342,12 @@ defmodule Mobilizon.Events do @spec events_for_search_query(String.t()) :: Ecto.Query.t() defp events_for_search_query("") do Event - |> distinct([e], e.id) + |> distinct([e], asc: e.begins_on, asc: e.id) end defp events_for_search_query(search_string) do from(event in Event, - distinct: event.id, + distinct: [asc: event.begins_on, asc: event.id], join: id_and_rank in matching_event_ids_and_ranks(search_string), on: id_and_rank.id == event.id )