Merge branch 'exclude-happening-events' into 'master'

Currently happening events are not future events

Closes #220

See merge request framasoft/mobilizon!460
This commit is contained in:
Thomas Citharel 2020-06-10 10:03:36 +02:00
commit a1c8114fb3

View File

@ -1506,11 +1506,10 @@ defmodule Mobilizon.Events do
from(e in query, where: e.draft == ^is_draft)
end
# Currently happening events are also future events
@spec filter_future_events(Ecto.Query.t(), boolean) :: Ecto.Query.t()
defp filter_future_events(query, true) do
from(q in query,
where: q.begins_on > ^DateTime.utc_now() or q.ends_on > ^DateTime.utc_now()
where: q.begins_on > ^DateTime.utc_now()
)
end