ensure that site notices are live when selected

This commit is contained in:
byte[] 2019-12-20 09:22:33 -05:00
parent 40debb9634
commit 0c5860c457

View file

@ -21,6 +21,7 @@ defmodule Philomena.SiteNotices do
now = DateTime.utc_now() now = DateTime.utc_now()
SiteNotice SiteNotice
|> where(live: true)
|> where([n], n.start_date < ^now and n.finish_date > ^now) |> where([n], n.start_date < ^now and n.finish_date > ^now)
|> order_by(desc: :start_date) |> order_by(desc: :start_date)
|> Repo.all() |> Repo.all()