Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear added patterns in TimetableSnapshot #6141

Merged
merged 5 commits into from
Oct 18, 2024

Conversation

vpaturet
Copy link
Contributor

Summary

#6007 moved the indexes for real-time added trips from the transit model index to the timetable snapshot.
However the code for clearing these indexes, which is required when the feed uses the incrementality mode FULL_DATASET, was missing.
This PR adds the logic for clearing these indexes.

Issue

No

Unit tests

Added unit test.

Documentation

No

@vpaturet vpaturet added Bug Real-Time Update The issue/PR is related to RealTime updates labels Oct 10, 2024
@vpaturet vpaturet force-pushed the clear_added_pattern branch from 2491e22 to 8c4f01e Compare October 10, 2024 15:02
@vpaturet vpaturet changed the title Clear added pattern in TimetableSnapshot Clear added patterns in TimetableSnapshot Oct 10, 2024
Copy link

codecov bot commented Oct 10, 2024

Codecov Report

Attention: Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.

Project coverage is 69.89%. Comparing base (fd2124e) to head (fef3951).
Report is 64 commits behind head on dev-2.x.

Files with missing lines Patch % Lines
...a/org/opentripplanner/model/TimetableSnapshot.java 93.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6141      +/-   ##
=============================================
- Coverage      69.90%   69.89%   -0.01%     
- Complexity     17708    17711       +3     
=============================================
  Files           1996     1996              
  Lines          75334    75348      +14     
  Branches        7713     7713              
=============================================
+ Hits           52660    52668       +8     
- Misses         19997    20000       +3     
- Partials        2677     2680       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vpaturet vpaturet force-pushed the clear_added_pattern branch from 8c4f01e to 11f0123 Compare October 10, 2024 15:18
@vpaturet vpaturet marked this pull request as ready for review October 10, 2024 15:23
@vpaturet vpaturet requested a review from a team as a code owner October 10, 2024 15:23
.keySet()
.removeIf(route -> feedId.equals(route.getId().getFeedId()));
realtimeAddedRoutes.keySet().removeIf(id -> feedId.equals(id.getFeedId()));
return removedEntry;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This removedEntry parameter is only set if trips were removed, not the other entries. If that is on purpose it would be nice with a comment explaining why that is valid.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed this is on purpose. Comment added.

* Clear all realtime added routes, trip patterns and trips matching the provided feed id.
*
* */
private boolean clearRealtimeAddedTripPatterns(String feedId) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a better name would be clearEntriesForRealtimeAddedTrips() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@t2gran t2gran added this to the 2.7 (next release) milestone Oct 16, 2024
# Conflicts:
#	application/src/test/java/org/opentripplanner/model/TimetableSnapshotTest.java
@vpaturet vpaturet merged commit 9c8e5a3 into opentripplanner:dev-2.x Oct 18, 2024
5 checks passed
t2gran pushed a commit that referenced this pull request Oct 18, 2024
@vpaturet vpaturet deleted the clear_added_pattern branch October 18, 2024 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Real-Time Update The issue/PR is related to RealTime updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants