Fix close events order

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-03-17 17:09:52 +01:00
parent 89ff49cb00
commit cfa94851fa
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -522,7 +522,7 @@ defmodule Mobilizon.Events do
|> filter_local_or_from_followed_instances_events() |> filter_local_or_from_followed_instances_events()
|> filter_public_visibility() |> filter_public_visibility()
|> event_order_begins_on_asc() |> event_order_begins_on_asc()
|> Page.build_page(page, limit) |> Page.build_page(page, limit, :begins_on)
end end
@doc """ @doc """
@ -1342,12 +1342,12 @@ defmodule Mobilizon.Events do
@spec events_for_search_query(String.t()) :: Ecto.Query.t() @spec events_for_search_query(String.t()) :: Ecto.Query.t()
defp events_for_search_query("") do defp events_for_search_query("") do
Event Event
|> distinct([e], e.id) |> distinct([e], asc: e.begins_on, asc: e.id)
end end
defp events_for_search_query(search_string) do defp events_for_search_query(search_string) do
from(event in Event, 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), join: id_and_rank in matching_event_ids_and_ranks(search_string),
on: id_and_rank.id == event.id on: id_and_rank.id == event.id
) )