Past games with the same moves merge, losing the newer game's date and opponent
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 84/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- javascript
研究方向
從 js/game-store.js 中的 addToArchive 和 js/game-ui.js 中的歸檔載入流程(handleArchiveClick)開始;js/notation.js 定義了著法文字的比較方式。閱讀 tests/unit/archive.test.js 並執行 npm test,檢查現有的歸檔行為。完成標準是:著法相同的不同對局仍然彼此獨立;重新開啟並歸檔某個對局時,會取代該對局自己的項目,即使該對局已經結束也一樣。
由索引模型根據 Issue 內容生成。
描述
Summary
addToArchive treats two past games as the same game when their FEN and their movetext match. The merge is meant for a game that was opened from the list and put back. But separate games with identical moves also merge, and the newer game's date and opponent are lost.
Where
js/game-store.js:79-83(addToArchive)js/notation.js:203(pgnMovetext)
Details
const same = (entry) => pgnMovetext(entry.pgn) === pgnMovetext(game.pgn);
const entry = archive.find(same) || game; // the older entry wins
The comparison ignores the player names, the date and the time control.
Impact
- Short games merge: every game abandoned after
1. e4, a quick resignation, or the same short line against different levels. The list shows one entry, with the first game's date and opponent. - In the other direction, a game archived while unfinished (
*) and later reopened and finished stays in the list twice, because the movetext differs.
Steps to reproduce
- Start a game, play 1.e4, then press New Game twice to discard it.
- Change the opponent level and repeat.
- Open Load. There is one "1 move" entry, with the first game's opponent and date.
Suggested fix
Remember which archive entry a game was opened from, for example by keeping that entry's date in gameStart when handleArchiveClick loads it. Merge only with that entry, and replace it, so a finished version replaces its unfinished copy. As a simpler alternative, add the White/Black tags and the date to the comparison key.
Acceptance criteria
- Two separate games with the same moves are kept as two entries
- A game opened from the list and put back replaces its own entry (also when it was finished meanwhile)
Getting started
- Relevant files:
js/game-store.js,js/game-ui.js(handleArchiveClick),tests/unit/archive.test.js - How to run tests:
npm ci && npm test
Filed by repo-audit/full-audit at 73cd279. Severity: low. Effort: S. audit-key: bug|js/game-store.js|addToArchive
- 主要語言
- JavaScript
- 星號
- 4
- 分支
- 2
- 平均合併
- 6 小時 13 分鐘
- 30 天內合併 PR
- 4
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
TMHSDigital/Static_Chess 的其他 Issue
-
enhancement good first issue severity: low
難度 2/5 1-3 小時 新手友好度 78/100
TMHSDigital/Static_Chess#163 ·
維護者通常 1 天內回覆
-
good first issue performance severity: low
難度 2/5 1-3 小時 新手友好度 86/100
TMHSDigital/Static_Chess#157 ·
維護者通常 1 天內回覆
-
documentation good first issue severity: low
難度 1/5 1-3 小時 新手友好度 90/100
TMHSDigital/Static_Chess#155 ·
維護者通常 1 天內回覆
-
good first issue reliability severity: low
難度 2/5 1-3 小時 新手友好度 88/100
TMHSDigital/Static_Chess#150 ·
維護者通常 1 天內回覆
-
bug good first issue severity: low
難度 2/5 1-3 小時 新手友好度 90/100
TMHSDigital/Static_Chess#145 ·
維護者通常 1 天內回覆
查看 TMHSDigital/Static_Chess 的全部 Issue
相似的 Issue
-
marketing
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
enhancement good first issue help wanted
難度 2/5 1-3 小時 新手友好度 88/100
-
[Bug] Account menu (footer ⚙) doesn't dismiss on outside click — stays open and covers the Bot list未關閉
難度 2/5 1-3 小時 新手友好度 82/100
Fei2411/DeepSeek-Bot#1693 ·
-
area-templates triage:bot-seen triage:needs-human
難度 2/5 1-3 小時 新手友好度 75/100
microsoft/aspire#22356 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
HarperFast/skills#153 ·