diff --git a/assets/js/propagation_map_hook.js b/assets/js/propagation_map_hook.js
index cd619f53..e315b2ef 100644
--- a/assets/js/propagation_map_hook.js
+++ b/assets/js/propagation_map_hook.js
@@ -142,8 +142,9 @@ function buildForecastSvg(forecast) {
Math.abs(p.time - now) < Math.abs(points[best].time - now) ? i : best, 0)
const nowPt = points[nowIdx]
- // Trend
- const firstScore = points[0].score
+ // Trend (from now onward)
+ const futurePoints = points.filter(p => p.time >= now)
+ const firstScore = futurePoints.length > 0 ? futurePoints[0].score : points[0].score
const lastScore = points[points.length - 1].score
const diff = lastScore - firstScore
let trend = ""
@@ -151,8 +152,9 @@ function buildForecastSvg(forecast) {
else if (diff < -5) trend = `▼ Declining`
else trend = `→ Steady`
- // Best time
- const bestPt = points.reduce((best, p) => p.score > best.score ? p : best, points[0])
+ // Best time (only future points)
+ const bestPool = futurePoints.length > 0 ? futurePoints : points
+ const bestPt = bestPool.reduce((best, p) => p.score > best.score ? p : best, bestPool[0])
const bestUtc = `${bestPt.time.getUTCHours().toString().padStart(2, "0")}:00 UTC`
const bestTier = scoreTier(bestPt.score)
diff --git a/lib/microwaveprop/propagation.ex b/lib/microwaveprop/propagation.ex
index eb91a68c..51f6fa8a 100644
--- a/lib/microwaveprop/propagation.ex
+++ b/lib/microwaveprop/propagation.ex
@@ -186,13 +186,15 @@ defmodule Microwaveprop.Propagation do
step = Grid.step()
snapped_lat = Float.round(Float.round(lat / step) * step, 3)
snapped_lon = Float.round(Float.round(lon / step) * step, 3)
+ now = DateTime.utc_now()
Repo.all(
from(gs in GridScore,
where:
gs.band_mhz == ^band_mhz and
gs.lat == ^snapped_lat and
- gs.lon == ^snapped_lon,
+ gs.lon == ^snapped_lon and
+ gs.valid_time >= ^now,
select: %{valid_time: gs.valid_time, score: gs.score},
order_by: [asc: gs.valid_time]
)