feedback7 stats: a match left right away stays in the history but does not count; bounded storage, corrupt-data handling, the page reworked as 干员调配-style tabs, the settlement re-view without the app store (PR #323 by @2321Robin, owner's decision of 2026-10-08); golden: unchanged

Counting rule (ui/stats.js countsTowardStats, the owner's decision of 2026-10-08: do not count the matches entered and left
right away, but keep them in the history): a settled match (m.result arrived) always counts; a match given up (放弃模拟)
counts once at least one of the player's battles had finished — a round cleared (the server's own rule, platform.js
_quit: leaving while round k runs has passed k - 1, in its settlement k) or already eliminated. Anything earlier is
history only: marked 中途退出 and 不计入统计, dimmed, listed in 对局记录, left out of every aggregate (games, wins, win
rate, strategy table, titles, rounds, time, combat totals); 总览 says how many were left out.
- A leaver gets no m.result, so the page records the match itself: quitMatch (放弃模拟) → recordQuit builds an
  `end: 'quit'` record from the app state and a tracker (observeMatch, installed in main.js) that remembers when the page
  first saw the match and the last round the player was seen alive in. No record for a spectator seat, a match with its
  settlement already there, a match the page never saw; matches the server ended and closed tabs are not recorded.

Defects of PR #323 as submitted, reproduced (scratchpad/w7-stats-notes/repro-pr-bugs.mjs, loads-check*.mjs) and fixed:
- the title screen loaded all 16 game data files (5.3 MB) at boot: <StatsHost/> called useGameData() at mount; now the
  host renders nothing until opened, the overview reads config / bands / assets and the settlement re-view loads the rest
  when opened (the title screen loads the same 3 files as before);
- importing a file put the list oldest first (the page shows the first 20 as the newest and the cap would drop the
  newest); the list is newest first everywhere, also when loaded from storage;
- recordResult wrote over the envelope of a NEWER build (a downgrade, against the PR's own rule); it refuses now, as
  saveStats does;
- 1000 four-player records are ~7.2 M characters (the PR's ~1.5 kB/record is a solo match) against a ~2.5 M-character
  quota: MAX_RECORDS 1000 stays, plus a 800 000-character budget (the oldest go first), and only the newest 30 records
  keep their rows (lineup, bonds, teammates' names; the replay needs them) — older ones are compacted to the player's own
  summary row (~620 characters), a refused write retries with half the history; unknown fields and oversized values are
  dropped (a strict schema), import files are bounded (8 MB);
- the re-view clobbered the app store (match.public / match.result, the route, the music); ResultScreen is split into
  ResultScreen (the store) and ResultView (props: result, myId, back label), so the stats page renders a stored match
  itself; a 自选 pick and a 补位 stand-in were dropped from the stored lineup (the replayed card drew the plain
  operator); DIFFICULTY_NAMES were not translated; a band cell was a display:flex <td>; the overlay stayed open when a
  co-op match started; the 清空 two-step blink was replaced by the shared confirm dialog.
- Corrupt storage: unreadable data is moved to sp.pref.stats.damaged and the page says so; damaged rows are dropped and
  counted; duplicates, an oversized or unsorted list are repaired on load; a pre-`end` (PR-era) envelope reads as settled.

UI: a full-screen overlay in the grammar of 干员调配 (top bar with 返回 / four tabs 总览 · 策略 · 战斗累计 · 对局记录 /
导出 导入 清空, a note line saying the data stays in this browser and that teammates' names are stored too), text sizes
with max(.xxrem, N px) for phones in landscape, a 50-row history page with 显示更多, a pass-rate bar, a per-difficulty
table in order; the entries use a new `chart` icon (not the ping bars), the title screen's sits beside the language menu
(the connection row has no room: it squeezed the gear and wrapped the status text), the lobby / room buttons show the
icon alone below 700 px (the room's title ran under the label at 640 px). docs/PLAYING.md §12, README row; 41 + 25 UI
strings in en / ja / ko / zh-TW (the PR's four unused ones removed).

Tests: test/ui/stats.test.js 44 / 44 (counting rule per phase, quit records, bounds, corrupt / old / newer storage,
import order, aggregation, the replay payload); test/ui/stats.e2e.test.js (opt-in SP_E2E=1, real server, headless Chrome:
seeded history on 1920×1080 and 844×390, the re-view, export / import / clear, corrupt and newer storage, and the real
flows: a solo match given up in the briefing is history only, one given up after round 1 counts, a settled match is
recorded once and not again after a reload) 6 / 6; lint 0 errors, i18n extract 0 / check --all --strict clean,
check:imports, typecheck, docs and version tests, golden unchanged.
This commit is contained in:
sganggs committed 2026-10-08 20:36:41 +08:00
1 parent 438a6b521a
commit 51e0e60b6e
20 files changed
+1808 -530

No files matched your search

+29 -8
View File
@@ -1058,7 +1058,6 @@
"开发版 · 不稳定,请勿用于公开服务器": "Development build · unstable, not for public servers",
"统计数据": "Statistics",
"统计": "Stats",
"对局进行中,暂不能回看历史结算": "A match is running — replays are unavailable right now",
"总览": "Overview",
"总局数": "Games",
"胜场": "Wins",
@@ -1076,7 +1075,6 @@
"通过率": "Clear rate",
"称号": "Titles",
"战斗累计": "Combat totals",
"最近对局": "Recent matches",
"时间": "Time",
"模式": "Mode",
"结果": "Result",
@@ -1085,16 +1083,39 @@
"同盟": "Co-op",
"胜": "Win",
"负": "Loss",
"点击任意一行,回看该局结算。": "Click a row to re-view that match's settlement.",
"已导出 {n} 条对局记录": "Exported {n} match records",
"已导入 {added} 条记录{tail}": "Imported {added} records{tail}",
"(跳过重复 {skipped} 条)": " ({skipped} duplicates skipped)",
"已导出 {n} 条对局记录": "Exported {n} match {n|record|records}",
"已导入 {added} 条记录{tail}": "Imported {added} {added|record|records}{tail}",
"(跳过重复 {skipped} 条)": " ({skipped} {skipped|duplicate|duplicates} skipped)",
"没有新记录(全部与现有数据重复)": "Nothing new (everything already exists)",
"导入失败:不是有效的统计导出文件": "Import failed: not a valid stats export file",
"已清空本机统计数据": "Local stats cleared",
"确认清空?": "Clear for sure?",
"本机数据 · 仅记录本浏览器中你参与的对局": "Local data · only matches you took part in, in this browser",
"检测到更新版本的统计数据,请先升级客户端再查看,以免覆盖数据。": "Stats data from a newer version detected — upgrade the client before viewing, or the data could be overwritten.",
"还没有记录 —— 完成一局对局后,这里会开始积累。": "No records yet — finish a match and the page starts filling in.",
"未知": "Unknown"
"未知": "Unknown",
"对局记录": "Match history",
"{n} 小时": "{n} h",
"计入统计:打到结算的对局,以及中途退出前至少清完 1 个回合的对局;更早退出的对局只留在对局记录里。": "Counted: matches played to the settlement, and matches given up after clearing at least 1 round. Matches given up earlier stay in the match history only.",
"另有 {n} 局未计入统计": "{n} more {n|match|matches} not counted",
"没有清完第一个回合就退出,不计入统计": "Left before clearing the first round — not counted",
"中途退出的对局没有结算可看": "A match given up has no settlement to view",
"较早的对局只保留汇总,不能回看结算": "Older matches keep only their summary — no settlement to view",
"中途退出": "Left early",
"不计入统计": "Not counted",
"显示更多(还有 {n} 局)": "Show more ({n} left)",
"点击一行,回看该局结算;中途退出的对局只留记录。": "Click a row to re-view that match's settlement; a match given up only leaves its entry.",
"最多保留最近 {max} 局,只有最新的 {full} 局能回看结算。": "Only the latest {max} matches are kept, and only the newest {full} can show their settlement again.",
"返回统计": "Back to Stats",
"文件过大,无法导入": "File too large to import",
"无法写入本机存储,可能已满": "Could not write to local storage — it may be full",
"({n} 条无法读取)": " ({n} unreadable)",
"导入失败:这份文件由更新版本的客户端导出,请先升级客户端": "Import failed: this file was exported by a newer client — upgrade the client first",
"清空统计数据": "Clear Statistics",
"将删除本机保存的 {n} 条对局记录,无法恢复。": "This deletes the {n} match {n|record|records} stored on this device. It cannot be undone.",
"导出为文件(可在别的设备上导入)": "Export to a file (import it on another device)",
"从导出的文件导入(与现有记录合并)": "Import from an exported file (merged with the current records)",
"清空本机的统计数据": "Clear the statistics stored on this device",
"本机数据:只保存在这个浏览器里,不会上传到服务器;同盟对局里队友的代号也会存在本机(导出文件里也有)。": "Local data: kept only in this browser, never uploaded to the server. Teammates' names from Team Simulations are stored here too (and appear in an export file).",
"本机保存的统计数据无法读取,已另存为备份,从现在起重新记录。": "The stats stored on this device could not be read. They were set aside as a backup and recording starts afresh.",
"有 {n} 条记录已损坏,已忽略。": "{n} damaged {n|record was|records were} ignored."
}
+26 -5
View File
@@ -1064,7 +1064,6 @@
"当前语言的界面文字为机器翻译,可能不够准确,欢迎在 GitHub 上指正。": "この言語の画面表示は機械翻訳のため、不正確な場合があります。GitHubでの修正提案を歓迎します。",
"统计数据": "統計データ",
"统计": "統計",
"对局进行中,暂不能回看历史结算": "対戦中のため、過去の結果は表示できません",
"总览": "概要",
"总局数": "対戦数",
"胜场": "勝利数",
@@ -1082,7 +1081,6 @@
"通过率": "クリア率",
"称号": "称号",
"战斗累计": "戦闘累計",
"最近对局": "最近の対戦",
"时间": "日時",
"模式": "モード",
"结果": "結果",
@@ -1091,16 +1089,39 @@
"同盟": "連合",
"胜": "勝",
"负": "敗",
"点击任意一行,回看该局结算。": "行をクリックすると、その対戦の結果をもう一度見られます。",
"已导出 {n} 条对局记录": "対戦記録を{n}件エクスポートしました",
"已导入 {added} 条记录{tail}": "{added}件の記録をインポートしました{tail}",
"(跳过重复 {skipped} 条)": "(重複{skipped}件をスキップ)",
"没有新记录(全部与现有数据重复)": "新しい記録はありません(すべて既存のデータと重複しています)",
"导入失败:不是有效的统计导出文件": "インポートに失敗しました:有効な統計のエクスポートファイルではありません",
"已清空本机统计数据": "この端末の統計データを消去しました",
"确认清空?": "本当に消去しますか?",
"本机数据 · 仅记录本浏览器中你参与的对局": "この端末のデータ · このブラウザで参加した対戦のみ記録されます",
"检测到更新版本的统计数据,请先升级客户端再查看,以免覆盖数据。": "より新しいバージョンの統計データが見つかりました。上書きを避けるため、クライアントを更新してから表示してください。",
"还没有记录 —— 完成一局对局后,这里会开始积累。": "記録はまだありません — 対戦を1つ終えると、ここに蓄積されていきます。",
"未知": "不明"
"未知": "不明",
"对局记录": "対戦履歴",
"{n} 小时": "{n}時間",
"计入统计:打到结算的对局,以及中途退出前至少清完 1 个回合的对局;更早退出的对局只留在对局记录里。": "集計対象:結果画面まで進んだ対戦と、1ラウンド以上クリアしてから途中退出した対戦。それより早く退出した対戦は対戦履歴にのみ残ります。",
"另有 {n} 局未计入统计": "他に{n}件の対戦が集計対象外です",
"没有清完第一个回合就退出,不计入统计": "最初のラウンドをクリアする前に退出したため、集計対象外です",
"中途退出的对局没有结算可看": "途中退出した対戦には表示できる結果がありません",
"较早的对局只保留汇总,不能回看结算": "古い対戦は要約のみ保存されているため、結果は表示できません",
"中途退出": "途中退出",
"不计入统计": "集計対象外",
"显示更多(还有 {n} 局)": "さらに表示(残り{n}件)",
"点击一行,回看该局结算;中途退出的对局只留记录。": "行をクリックすると、その対戦の結果をもう一度見られます。途中退出した対戦は記録のみ残ります。",
"最多保留最近 {max} 局,只有最新的 {full} 局能回看结算。": "保存されるのは直近{max}件のみで、結果を再表示できるのは最新の{full}件だけです。",
"返回统计": "統計に戻る",
"文件过大,无法导入": "ファイルが大きすぎるためインポートできません",
"无法写入本机存储,可能已满": "ローカルストレージに書き込めません。容量がいっぱいの可能性があります",
"({n} 条无法读取)": "(読み取れない記録{n}件)",
"导入失败:这份文件由更新版本的客户端导出,请先升级客户端": "インポートに失敗しました:このファイルはより新しいバージョンのクライアントでエクスポートされています。先にクライアントを更新してください",
"清空统计数据": "統計データを消去",
"将删除本机保存的 {n} 条对局记录,无法恢复。": "この端末に保存されている対戦記録{n}件を削除します。元に戻せません。",
"导出为文件(可在别的设备上导入)": "ファイルにエクスポート(別の端末でインポートできます)",
"从导出的文件导入(与现有记录合并)": "エクスポートしたファイルからインポート(既存の記録と統合)",
"清空本机的统计数据": "この端末の統計データを消去",
"本机数据:只保存在这个浏览器里,不会上传到服务器;同盟对局里队友的代号也会存在本机(导出文件里也有)。": "この端末のデータ:このブラウザにのみ保存され、サーバーには送信されません。連合演算の仲間の名前もこの端末に保存されます(エクスポートファイルにも含まれます)。",
"本机保存的统计数据无法读取,已另存为备份,从现在起重新记录。": "この端末に保存された統計データを読み取れませんでした。バックアップとして退避し、記録を最初からやり直します。",
"有 {n} 条记录已损坏,已忽略。": "破損した記録{n}件を無視しました。"
}
+26 -5
View File
@@ -1060,7 +1060,6 @@
"当前语言的界面文字为机器翻译,可能不够准确,欢迎在 GitHub 上指正。": "현재 언어의 인터페이스 텍스트는 기계 번역이므로 정확하지 않을 수 있습니다. GitHub에서 수정 제안을 환영합니다.",
"统计数据": "통계",
"统计": "통계",
"对局进行中,暂不能回看历史结算": "시뮬레이션이 진행 중이라 지난 정산을 다시 볼 수 없습니다",
"总览": "개요",
"总局数": "총 판수",
"胜场": "승리",
@@ -1078,7 +1077,6 @@
"通过率": "클리어율",
"称号": "평가",
"战斗累计": "전투 누적",
"最近对局": "최근 판",
"时间": "시간",
"模式": "모드",
"结果": "결과",
@@ -1087,16 +1085,39 @@
"同盟": "동맹",
"胜": "승",
"负": "패",
"点击任意一行,回看该局结算。": "행을 누르면 해당 판의 정산을 다시 볼 수 있습니다.",
"已导出 {n} 条对局记录": "기록 {n}건을 내보냈습니다",
"已导入 {added} 条记录{tail}": "기록 {added}건을 가져왔습니다{tail}",
"(跳过重复 {skipped} 条)": " (중복 {skipped}건 건너뜀)",
"没有新记录(全部与现有数据重复)": "새 기록이 없습니다(모두 기존 데이터와 중복)",
"导入失败:不是有效的统计导出文件": "가져오기 실패: 올바른 통계 내보내기 파일이 아닙니다",
"已清空本机统计数据": "이 기기의 통계 데이터를 삭제했습니다",
"确认清空?": "정말 비우시겠습니까?",
"本机数据 · 仅记录本浏览器中你参与的对局": "이 기기의 데이터 · 이 브라우저에서 참여한 판만 기록됩니다",
"检测到更新版本的统计数据,请先升级客户端再查看,以免覆盖数据。": "더 최신 버전의 통계 데이터가 감지되었습니다. 데이터를 덮어쓰지 않도록 클라이언트를 업데이트한 뒤 확인하세요.",
"还没有记录 —— 完成一局对局后,这里会开始积累。": "아직 기록이 없습니다 — 한 판을 마치면 여기에 쌓이기 시작합니다.",
"未知": "알 수 없음"
"未知": "알 수 없음",
"对局记录": "판 기록",
"{n} 小时": "{n}시간",
"计入统计:打到结算的对局,以及中途退出前至少清完 1 个回合的对局;更早退出的对局只留在对局记录里。": "집계 대상: 정산까지 진행한 판, 그리고 1라운드 이상 클리어한 뒤 중도 포기한 판. 그보다 일찍 나간 판은 판 기록에만 남습니다.",
"另有 {n} 局未计入统计": "집계에 포함되지 않은 판이 {n}건 더 있습니다",
"没有清完第一个回合就退出,不计入统计": "첫 라운드를 클리어하기 전에 나가서 집계에 포함되지 않습니다",
"中途退出的对局没有结算可看": "중도 포기한 판은 볼 수 있는 정산이 없습니다",
"较早的对局只保留汇总,不能回看结算": "오래된 판은 요약만 저장되어 정산을 볼 수 없습니다",
"中途退出": "중도 퇴장",
"不计入统计": "집계 제외",
"显示更多(还有 {n} 局)": "더 보기 (남은 {n}건)",
"点击一行,回看该局结算;中途退出的对局只留记录。": "행을 누르면 해당 판의 정산을 다시 볼 수 있습니다. 중도 포기한 판은 기록만 남습니다.",
"最多保留最近 {max} 局,只有最新的 {full} 局能回看结算。": "최근 {max}판까지만 보관하며, 정산을 다시 볼 수 있는 것은 최신 {full}판뿐입니다.",
"返回统计": "통계로 돌아가기",
"文件过大,无法导入": "파일이 너무 커서 가져올 수 없습니다",
"无法写入本机存储,可能已满": "로컬 저장소에 쓰지 못했습니다. 공간이 가득 찼을 수 있습니다",
"({n} 条无法读取)": " (읽을 수 없는 기록 {n}건)",
"导入失败:这份文件由更新版本的客户端导出,请先升级客户端": "가져오기 실패: 더 최신 버전 클라이언트에서 내보낸 파일입니다. 먼저 클라이언트를 업데이트하세요",
"清空统计数据": "통계 데이터 비우기",
"将删除本机保存的 {n} 条对局记录,无法恢复。": "이 기기에 저장된 기록 {n}건을 삭제합니다. 되돌릴 수 없습니다.",
"导出为文件(可在别的设备上导入)": "파일로 내보내기 (다른 기기에서 가져올 수 있습니다)",
"从导出的文件导入(与现有记录合并)": "내보낸 파일에서 가져오기 (기존 기록과 병합)",
"清空本机的统计数据": "이 기기의 통계 데이터 비우기",
"本机数据:只保存在这个浏览器里,不会上传到服务器;同盟对局里队友的代号也会存在本机(导出文件里也有)。": "이 기기의 데이터: 이 브라우저에만 저장되며 서버로 전송되지 않습니다. 동맹 시뮬레이션에서 함께한 동료의 이름도 이 기기에 저장됩니다(내보낸 파일에도 포함).",
"本机保存的统计数据无法读取,已另存为备份,从现在起重新记录。": "이 기기에 저장된 통계 데이터를 읽을 수 없습니다. 백업으로 따로 보관했으며 지금부터 새로 기록합니다.",
"有 {n} 条记录已损坏,已忽略。": "손상된 기록 {n}건을 무시했습니다."
}
+26 -5
View File
@@ -1062,7 +1062,6 @@
"生命值减少 −{n}": "生命值減少 −{n}",
"统计数据": "統計資料",
"统计": "統計",
"对局进行中,暂不能回看历史结算": "對局進行中,暫時無法回看歷史結算",
"总览": "總覽",
"总局数": "總局數",
"胜场": "勝場",
@@ -1080,7 +1079,6 @@
"通过率": "通過率",
"称号": "稱號",
"战斗累计": "戰鬥累計",
"最近对局": "最近對局",
"时间": "時間",
"模式": "模式",
"结果": "結果",
@@ -1089,16 +1087,39 @@
"同盟": "同盟",
"胜": "勝",
"负": "負",
"点击任意一行,回看该局结算。": "點擊任一行,回看該局結算。",
"已导出 {n} 条对局记录": "已匯出 {n} 筆對局記錄",
"已导入 {added} 条记录{tail}": "已匯入 {added} 筆記錄{tail}",
"(跳过重复 {skipped} 条)": "(略過重複 {skipped} 筆)",
"没有新记录(全部与现有数据重复)": "沒有新記錄(全部與現有資料重複)",
"导入失败:不是有效的统计导出文件": "匯入失敗:不是有效的統計匯出檔案",
"已清空本机统计数据": "已清空本機統計資料",
"确认清空?": "確認清空?",
"本机数据 · 仅记录本浏览器中你参与的对局": "本機資料 · 僅記錄本瀏覽器中你參與的對局",
"检测到更新版本的统计数据,请先升级客户端再查看,以免覆盖数据。": "偵測到更新版本的統計資料,請先升級用戶端再查看,以免覆蓋資料。",
"还没有记录 —— 完成一局对局后,这里会开始积累。": "還沒有記錄 —— 完成一局對局後,這裡會開始累積。",
"未知": "未知"
"未知": "未知",
"对局记录": "對局記錄",
"{n} 小时": "{n} 小時",
"计入统计:打到结算的对局,以及中途退出前至少清完 1 个回合的对局;更早退出的对局只留在对局记录里。": "計入統計:打到結算的對局,以及中途退出前至少清完 1 個回合的對局;更早退出的對局只留在對局記錄裡。",
"另有 {n} 局未计入统计": "另有 {n} 局未計入統計",
"没有清完第一个回合就退出,不计入统计": "沒有清完第一個回合就退出,不計入統計",
"中途退出的对局没有结算可看": "中途退出的對局沒有結算可看",
"较早的对局只保留汇总,不能回看结算": "較早的對局只保留彙總,不能回看結算",
"中途退出": "中途退出",
"不计入统计": "不計入統計",
"显示更多(还有 {n} 局)": "顯示更多(還有 {n} 局)",
"点击一行,回看该局结算;中途退出的对局只留记录。": "點擊一行,回看該局結算;中途退出的對局只留記錄。",
"最多保留最近 {max} 局,只有最新的 {full} 局能回看结算。": "最多保留最近 {max} 局,只有最新的 {full} 局能回看結算。",
"返回统计": "返回統計",
"文件过大,无法导入": "檔案過大,無法匯入",
"无法写入本机存储,可能已满": "無法寫入本機儲存空間,可能已滿",
"({n} 条无法读取)": "({n} 筆無法讀取)",
"导入失败:这份文件由更新版本的客户端导出,请先升级客户端": "匯入失敗:這份檔案由更新版本的用戶端匯出,請先升級用戶端",
"清空统计数据": "清空統計資料",
"将删除本机保存的 {n} 条对局记录,无法恢复。": "將刪除本機保存的 {n} 筆對局記錄,無法復原。",
"导出为文件(可在别的设备上导入)": "匯出為檔案(可在別的裝置上匯入)",
"从导出的文件导入(与现有记录合并)": "從匯出的檔案匯入(與現有記錄合併)",
"清空本机的统计数据": "清空本機的統計資料",
"本机数据:只保存在这个浏览器里,不会上传到服务器;同盟对局里队友的代号也会存在本机(导出文件里也有)。": "本機資料:只保存在這個瀏覽器裡,不會上傳到伺服器;同盟對局裡隊友的代號也會存在本機(匯出檔案裡也有)。",
"本机保存的统计数据无法读取,已另存为备份,从现在起重新记录。": "本機保存的統計資料無法讀取,已另存為備份,從現在起重新記錄。",
"有 {n} 条记录已损坏,已忽略。": "有 {n} 筆記錄已損毀,已略過。"
}