From f8b17d16ea1f4152735f846d2a66d230ab2923e3 Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Sun, 22 Mar 2026 23:28:48 +0800 Subject: [PATCH] Preserve hourly peak observations in temperature charts --- frontend/lib/dashboard-utils.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/frontend/lib/dashboard-utils.ts b/frontend/lib/dashboard-utils.ts index dbf358a1..cb73632d 100644 --- a/frontend/lib/dashboard-utils.ts +++ b/frontend/lib/dashboard-utils.ts @@ -276,8 +276,13 @@ export function getTemperatureChartData( if (Number.isNaN(hour)) return; const key = `${String(hour).padStart(2, "0")}:00`; const index = times.indexOf(key); - if (index >= 0 && metarPoints[index] === null) { - metarPoints[index] = item.temp ?? null; + const temp = item.temp ?? null; + if (index >= 0 && temp != null) { + const existing = metarPoints[index]; + // Multiple reports can land in the same hour bucket. Keep the peak + // value so an intrahour high is not hidden by a later weaker report. + metarPoints[index] = + existing == null ? temp : Math.max(Number(existing), Number(temp)); } });