Order my group upcoming events by begins_on

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-11-24 09:28:59 +01:00 committed by tykayn
parent 780971f19c
commit 9c60d5c670

View File

@ -16,7 +16,7 @@ defmodule Mobilizon.FollowedGroupActivity do
) :: Page.t(Event.t()) ) :: Page.t(Event.t())
def user_followed_group_events(user_id, after_datetime \\ nil, page \\ nil, limit \\ nil) do def user_followed_group_events(user_id, after_datetime \\ nil, page \\ nil, limit \\ nil) do
Event Event
|> distinct([e], e.id) |> distinct([e], [e.begins_on, e.id])
|> join(:left, [e], p in Participant, on: e.id == p.event_id) |> join(:left, [e], p in Participant, on: e.id == p.event_id)
|> join(:inner, [_e, p], pa in Actor, on: p.actor_id == pa.id) |> join(:inner, [_e, p], pa in Actor, on: p.actor_id == pa.id)
|> join(:inner, [e], g in Actor, on: e.attributed_to_id == g.id) |> join(:inner, [e], g in Actor, on: e.attributed_to_id == g.id)