Fix : Sadang-bound Train Display - #107
Conversation
|
Warning Review limit reached
Next review available in: 36 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe subway timetable filter now excludes Line 4 trains traveling in direction 2 with destination 사당. Existing filtering, sorting, slicing, and rendering behavior remains unchanged. ChangesSubway timetable filtering
Estimated code review effort: 2 (Simple) | ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request updates the subway timetable filtering in Subway.tsx to exclude Line 4 southbound trains terminating at Sadang ('사당'). The reviewer suggests a more robust and maintainable solution: instead of blacklisting specific terminating stations, the code should whitelist only the valid southbound destinations ('안산', '오이도', '인천') that actually pass through the target stations, which avoids similar issues with other terminating trains.
| (val) => | ||
| val.direction === direction && | ||
| val.destination !== null && | ||
| !( | ||
| val.line === '4' && | ||
| val.direction === 2 && | ||
| val.destination === '사당' | ||
| ), | ||
| ) |
There was a problem hiding this comment.
🔍 Robust Filtering for Southbound Trains
While filtering out Sadang-bound (사당) southbound trains fixes the immediate issue, this approach is incomplete and prone to similar bugs for other terminating stations.
The Issue
The Seoul Metro API returns upstream trains, some of which terminate before reaching the current station (Hanyang Univ. at Ansan or Jungang).
Besides 사당, there are other southbound terminating stations upstream that will exhibit the exact same bug (e.g., showing up on the UI but never arriving):
- Line 4: Trains terminating at
금정(Geumjeong) or산본(Sanbon). - Suin-Bundang Line: Trains terminating at
고색(Gosaek),수원(Suwon), or죽전(Jukjeon).
The Solution
Instead of blacklisting specific stations like 사당, we should whitelist the only valid southbound (direction 2) destinations that actually reach or pass through Hanyang Univ. at Ansan and Jungang:
안산(Ansan)오이도(Oido)인천(Incheon)
Any other southbound destination is invalid and should be filtered out. This is much more robust, cleaner, and prevents future bugs with other terminating trains.
(val) =>
val.direction === direction &&
val.destination !== null &&
(direction !== 2 ||
['안산', '오이도', '인천'].includes(val.destination)),
)
Deploying hybus-genesis with
|
| Latest commit: |
1a684e4
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b6e06150.hybus-genesis.pages.dev |
| Branch Preview URL: | https://dev-fix-train-display.hybus-genesis.pages.dev |
|
Check out your Lighthouse Report: https://lighthouse.hybus.app/app/projects/bushanyang-production/dashboard |
Describe your Pull Request
Additional content
Summary by CodeRabbit