Repository navigation
Conversation
Platform: all Fix(zh-Hant): 修正地震速報的圖例最高只到警報回報的震度、地圖卻塗到更高一級時,顏色與圖例對不上的問題 Fix(en-US): fix the map legend stopping below an intensity the map does paint
Codecov Report❌ Patch coverage is ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Platform: all Fix(zh-Hant): 地震速報改用 ML 模型預測的全國最大震度 Fix(en-US): use the ML model's nationwide maximum intensity for EEW
Contributor
|
這次改為在 EEW 資料進入 realtime channel 時處理:
Commit: |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
這個 PR 做了什麼
地震速報的圖例上限改成跟著「地圖實際塗到的最高震度」,而不是警報自己回報的
max。前一個 PR(#656)讓圖例在速報時只顯示到預估最高震度,但地圖的著色是
eewTownLevels自己算的(ML 模型,模型還沒好時用公式),它可以算得比警報回報的整數級更高。結果就是 #ET-2026-0199 討論串裡烤大鴨 11/05 貼的那張圖:資訊欄和圖例只到 2 級,地圖上卻有 3 級的顏色——圖例少一格,那個顏色就被讀成別的震度。改動內容
正式程式碼:
lib/features/earthquake/domain/eew_town_levels.dart:新增highestPaintedLevel()(掃過整張 368 鄉鎮的預估、忽略透明的 0)與legendCeiling()(回報值與實際著色取較高者;兩者都不知道時回 null,顯示完整色階)。lib/features/map/presentation/layers/rts_layer.dart:_updateAreaFill把著色到的最高級別寫進_paintedMaxLevel,沒有速報時清成 null;buildLegend改成同時聽這個 notifier,用legendCeiling算上限。lib/features/earthquake/presentation/pages/report_replay_page.dart:回放頁的_ReplayMapState走同一條路,把著色上限交回頁面上方的圖例。lib/shared/widgets/intensity_legend.dart:只補maxEewLevel的註解,說明它是「著色的上限」而不是警報回報值,沒有行為改動。測試:
test/features/earthquake/domain/eew_town_levels_test.dart:新增兩則——highestPaintedLevel要忽略 0 級的鄉鎮;legendCeiling在地圖算得比回報值高時要取地圖那個值。刻意沒做的:
相關 issue
怎麼驗
tool/dev/analyze.sh:通過(dart format --set-exit-if-changed與flutter analyze都沒有問題)。tool/dev/test.sh:本機 3670 個測試通過;另有test/tool/*_script_test.dart共 10 個失敗(Expected: <7> Actual: <126>,執行暫存腳本時拿不到執行權限)。我把origin/main(07c0c3d)開成乾淨的 worktree 重跑test/tool/run_script_test.dart,同樣的測試以相同錯誤失敗,確認與這個改動無關、是本機環境的問題。tool/check/commits.sh origin/main..HEAD通過。檢查清單
tool/check/commits.sh origin/main..HEAD通過mise exec -- flutter analyze與mise exec -- flutter test通過 —— analyze 通過、測試只有上述與改動無關的 10 個環境失敗AppLocalizations,沒有寫死(這次沒有新增字串)