Repository navigation
表示名が同じ別ユーザーがカレンダーで 1 人にまとめられる不具合を修正 - #79
Merged
Merged
Conversation
カレンダーで人物ごとにシフトをまとめる mergeShiftsByPerson() は、人物を 区別するキーに表示名と userEmail / email を使っていた。しかしこの 2 つは シフトデータに含まれておらず常に undefined で、実質的に表示名だけで 区別していた。 そのため表示名が同じ別ユーザーが 1 人として表示され、同じ時間帯に入って いると片方のチェックボックスに両方の UUID が入り、1 人分を削除した つもりでもう 1 人のシフトまで削除対象になっていた。 キーを userId に変更した。シフト申請カレンダー側はデータに userId を 入れていなかったため、あわせて渡すようにした。 utils.js にあった古い mergeShiftsByPerson() は、読み込み順で calendar.js の 定義に上書きされて使われておらず、同じ不具合を持っていたため削除した。 テストは calendar.js / utils.js にエクスポートガードを追加し、実コードを 直接 import して検証している (docs/refactoring/phase-1-test-foundation.md の方針)。 テスト: 434 passed (34 suites) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
概要
表示名が同じ別ユーザーが、カレンダー上で 1 人にまとめて表示される不具合を修正します。同じ時間帯に入っていると、1 人分を削除したつもりでもう 1 人のシフトまで削除対象になっていました。
原因
mergeShiftsByPerson()(js/modules/calendar.js)は、人物を区別するキーに表示名とuserEmail/emailを使っていました。この 2 つはシフトデータに含まれておらず常にundefinedで、実質的に表示名だけで区別していました。変更内容
userIdに変更しました。displayShiftsOnRequestCalendar)のデータにuserIdを渡すようにしました。こちらはuserId自体が入っておらず、キーの変更だけでは直らないためです。js/modules/utils.jsにあった古いmergeShiftsByPerson()を削除しました。index.htmlの読み込み順でcalendar.jsの定義に上書きされて使われておらず、同じ不具合を持っていました。calendar.jsとutils.jsにエクスポートガードを追加しました。ブラウザでは何もしません。テスト
test/calendar-merge-same-display-name.test.jsを追加しました。実コードを直接 import して検証しています(docs/refactoring/phase-1-test-foundation.mdの方針)。修正前は 4 件中 2 件が失敗することを確認しています。npm test: 434 passed(34 suites)userIdを渡す 2 行は、関数内の処理で import できないため、単体テストでは検証できていません。補足
test/regression-bugs.test.jsとtest/special-shift-calendar-badge.test.jsにはmergeShiftsByPersonのインラインコピーが残っています。この PR では手を入れていません。🤖 Generated with Claude Code