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
parent 147ea64483
commit 9aaea50f59
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -16,7 +16,7 @@ defmodule Mobilizon.FollowedGroupActivity do
) :: Page.t(Event.t())
def user_followed_group_events(user_id, after_datetime \\ nil, page \\ nil, limit \\ nil) do
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(: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)