forked from potsda.mn/mobilizon
Make sure featured events have currently happening events
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
68c8017141
commit
5b1b7ee164
|
@ -1433,9 +1433,12 @@ defmodule Mobilizon.Events do
|
||||||
from(e in query, where: e.draft == ^is_draft)
|
from(e in query, where: e.draft == ^is_draft)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Currently happening events are also future events
|
||||||
@spec filter_future_events(Ecto.Query.t(), boolean) :: Ecto.Query.t()
|
@spec filter_future_events(Ecto.Query.t(), boolean) :: Ecto.Query.t()
|
||||||
defp filter_future_events(query, true) do
|
defp filter_future_events(query, true) do
|
||||||
from(q in query, where: q.begins_on > ^DateTime.utc_now())
|
from(q in query,
|
||||||
|
where: q.begins_on > ^DateTime.utc_now() or q.ends_on > ^DateTime.utc_now()
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp filter_future_events(query, false), do: query
|
defp filter_future_events(query, false), do: query
|
||||||
|
|
Loading…
Reference in a new issue