Filter past hours from forecast timeline (30-min grace for current hour)
This commit is contained in:
parent
6dff6372ab
commit
4151f7d314
1 changed files with 4 additions and 2 deletions
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue