include ongoing events in search

This commit is contained in:
setop 2022-05-02 06:48:15 +00:00 committed by Thomas Citharel
parent 4e218746a8
commit f071f70d1f
1 changed files with 6 additions and 1 deletions

View File

@ -1296,7 +1296,12 @@ defmodule Mobilizon.Events do
if is_nil(begins_on) do
query
else
where(query, [q], q.begins_on >= ^begins_on)
where(
query,
[q],
(not is_nil(q.ends_on) and q.ends_on > ^begins_on) or
(is_nil(q.ends_on) and q.begins_on >= ^begins_on)
)
end
end