From 4151f7d31462dd90360fdcea3425dc9d4b4c2351 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Tue, 31 Mar 2026 17:47:16 -0500 Subject: [PATCH] Filter past hours from forecast timeline (30-min grace for current hour) --- lib/microwaveprop/propagation.ex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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]