Repository navigation
プリセットに乗車駅を保存して始発駅が直通先の終端になる問題を修正 - #6651
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01PWNLSQntywfT1pGEFs9bvb
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (11)
📝 WalkthroughWalkthroughプリセット経路に始発駅IDを追加しました。保存時に始発駅と方向を解決します。始発駅IDをSQLiteへ保存し、表示時の停車駅範囲、乗車開始候補、経路端点の復元に使用します。旧プリセットは方向ベースで復元します。 Changes始発駅付きプリセット経路
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant SelectBoundModal
participant resolvePresetSaveRoute
participant usePresetStops
participant SavedRoutesSQLite
SelectBoundModal->>resolvePresetSaveRoute: 現在駅または座標から始発駅と方向を解決
SelectBoundModal->>usePresetStops: 保存済み始発駅IDを渡す
SelectBoundModal->>SavedRoutesSQLite: originStationIdと方向を保存
SavedRoutesSQLite-->>usePresetStops: 保存済み経路を復元
usePresetStops-->>SelectBoundModal: 始発駅を基準に停車駅範囲を返す
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
4 of 9 tasks
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.
概要
地下鉄赤塚で「地下鉄赤塚〜新宿三丁目」のプリセットを作ると「森林公園〜新宿三丁目」として作成される問題を修正します。
原因は、乗車駅がプリセットに保存されていなかったことです。保存されるのは
direction(駅一覧のどちら側の終端から乗るか)だけで、始発駅の表示はgetPresetRouteEndpointsがdirectionから求めた終端でした。乗車駅が終点より手前なので
direction: INBOUNDとなり、始発駅がstations[0]= 森林公園に解決されていました。先に #6644 で駅一覧を系統全体(直通を含む)へ揃えたことで終端が 和光市 から 森林公園 へ延び、ズレが目に見えるようになりましたが、根本原因は乗車駅を保存していないデータモデル側にあります。
変更の種類
変更内容
SavedRouteとsaved_routesテーブルにoriginStationId(駅グループID)を追加。既存DBにはinitDbのALTER TABLEで追加されるため、マイグレーションの追加作業は不要resolvePresetSaveDirectionをresolvePresetSaveRouteへ変更し、経路内の最寄駅(=乗車駅)とdirectionの両方を返すようにした。保存時にその駅をoriginStationIdとして永続化するgetPresetRouteEndpoints:originStationIdがあればその駅を始発駅として返す。プリセットカードとホーム画面ウィジェットの双方に反映されるusePresetStops:presetOriginに保存された乗車駅を使い、presetStopsもその駅から終点までに絞るusePresetCarouselDataの displayKey にoriginStationIdを追加影響範囲・リグレッションリスク
originStationIdを持たない既存プリセットはdirectionからの終端解決へフォールバックするため、挙動は変わらないpresetStops)が変わる。これが本 PR の目的directionは引き続き保存する。古いプリセットの復元と、駅一覧の並びが保存時と反転した場合の検出に必要なためテスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ること報告と同じ条件(森林公園〜渋谷の直通系統で、地下鉄赤塚から新宿三丁目行きを保存)で端点が「地下鉄赤塚 → 新宿三丁目」になることを検証するテストを追加しています。あわせて、乗車駅を持たない古いプリセットが従来どおり終端を表示することも検証しました。
npm testは 217 suites / 2293 tests すべて成功。なお、この環境には API の接続情報も実機も無いため、実際の副都心線データでの表示確認は行えていません。
関連Issue
スクリーンショット(任意)
Generated by Claude Code
Summary by CodeRabbit
新機能
改善