From 1e1a78e9469ecb306d3e7b3897c5920681423a11 Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Tue, 16 Jun 2026 04:34:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E7=BB=88=E7=AB=AF=20METAR=20?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E6=B8=A9=E5=BA=A6=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...temperatureDefaultVisibilityPolicy.test.ts | 57 ++++++++++++++++++- .../scan-terminal/temperature-chart-logic.ts | 8 ++- 2 files changed, 61 insertions(+), 4 deletions(-) diff --git a/frontend/components/dashboard/scan-terminal/__tests__/temperatureDefaultVisibilityPolicy.test.ts b/frontend/components/dashboard/scan-terminal/__tests__/temperatureDefaultVisibilityPolicy.test.ts index 6012b83a..7d27327c 100644 --- a/frontend/components/dashboard/scan-terminal/__tests__/temperatureDefaultVisibilityPolicy.test.ts +++ b/frontend/components/dashboard/scan-terminal/__tests__/temperatureDefaultVisibilityPolicy.test.ts @@ -1035,8 +1035,61 @@ export function runTests() { isShenzhen: false, displayMetarTemp: 72.0, observedHighMetar: 73.9, - }) === 73.9, - "non-HKO compact secondary stat should keep the existing daily-high behavior", + }) === 72.0, + "non-HKO compact secondary stat should render the latest METAR/current point, not the daily high", + ); + + const wuhanEarlyMorningMetrics = __getObservationDisplayMetricsForTest( + { + city: "wuhan", + local_date: "2026-06-16", + local_time: "04:23", + tz_offset_seconds: 8 * 60 * 60, + current_temp: 22.8, + current_max_so_far: 33.0, + temp_symbol: "°C", + metar_context: { + airport_current_temp: 23.0, + airport_max_so_far: 33.0, + airport_obs_time: "04:00", + }, + } as any, + { + localTime: "04:23", + times: ["00:00", "04:00", "12:00", "18:00"], + temps: [24.0, 23.0, 33.0, 29.0], + settlementTodayObs: [ + { time: "04:00", temp: 23.0 }, + ], + airportCurrent: { + temp: 23.0, + max_so_far: 33.0, + obs_time: "2026-06-16T04:00:00+08:00", + }, + runwayPlateHistory: { + "04/22": [ + { time: "04:20", temp: 22.8 }, + ], + }, + } as any, + null, + ); + assert( + wuhanEarlyMorningMetrics.currentMetarTemp === 23.0, + "Wuhan early-morning METAR current metric should use the latest settlement point", + ); + assert( + wuhanEarlyMorningMetrics.observedHighMetar === 33.0, + "Wuhan METAR daily high can remain available separately from the compact current stat", + ); + assert( + __selectCompactSecondaryTempForTest({ + isHKO: false, + isShenzhen: false, + displayMetarTemp: (wuhanEarlyMorningMetrics as any).currentMetarTemp, + observedHighMetar: wuhanEarlyMorningMetrics.observedHighMetar, + }) === 23.0, + "Wuhan compact METAR settlement stat should not show a stale daily high at 04:23", ); const wuhanRunwayChart = __buildTemperatureChartDataForTest( diff --git a/frontend/components/dashboard/scan-terminal/temperature-chart-logic.ts b/frontend/components/dashboard/scan-terminal/temperature-chart-logic.ts index 444b2fcd..984433d7 100644 --- a/frontend/components/dashboard/scan-terminal/temperature-chart-logic.ts +++ b/frontend/components/dashboard/scan-terminal/temperature-chart-logic.ts @@ -964,10 +964,14 @@ function selectCompactSecondaryTemp({ displayMetarTemp: number | null; observedHighMetar: number | null; }) { - if (isHKO && !isShenzhen && displayMetarTemp !== null) { + if (isShenzhen) { + return observedHighMetar; + } + // The compact secondary label is an observation cadence, so it must not display a daily high. + if (isHKO) { return displayMetarTemp; } - return observedHighMetar; + return displayMetarTemp; } function isSettlementRunway(row: ScanOpportunityRow | null, rwy: string) {