Skip to content

Clear added patterns in TimetableSnapshot#6141

Merged
vpaturet merged 5 commits into
opentripplanner:dev-2.xfrom
entur:clear_added_pattern
Oct 18, 2024
Merged

Clear added patterns in TimetableSnapshot#6141
vpaturet merged 5 commits into
opentripplanner:dev-2.xfrom
entur:clear_added_pattern

Conversation

@vpaturet

Copy link
Copy Markdown
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 Apply to issues describing a bug and PRs witch fixes it. +Real-Time 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
@codecov

codecov Bot commented Oct 10, 2024

Copy link
Copy Markdown

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;

@habrahamsson-skanetrafiken habrahamsson-skanetrafiken Oct 11, 2024

Copy link
Copy Markdown
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
Copy Markdown
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) {

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
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 Apply to issues describing a bug and PRs witch fixes it. +Real-Time The issue/PR is related to RealTime updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants