Filter past hours from forecast timeline (30-min grace for current hour)

This commit is contained in:
Graham McIntire 2026-03-31 17:47:16 -05:00
parent 6dff6372ab
commit 4151f7d314
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59

View file

@ -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]