diff --git a/lib/microwaveprop/propagation.ex b/lib/microwaveprop/propagation.ex index f259d22c..0fd021e3 100644 --- a/lib/microwaveprop/propagation.ex +++ b/lib/microwaveprop/propagation.ex @@ -121,11 +121,13 @@ defmodule Microwaveprop.Propagation do end end - @doc "Returns all distinct valid_times for a band, ordered ascending." + @doc "Returns distinct valid_times for a band from now onward, ordered ascending." def available_valid_times(band_mhz) do + now = DateTime.utc_now() |> DateTime.add(-1800, :second) + Repo.all( from(gs in GridScore, - where: gs.band_mhz == ^band_mhz, + where: gs.band_mhz == ^band_mhz and gs.valid_time >= ^now, select: gs.valid_time, distinct: gs.valid_time, order_by: [asc: gs.valid_time]