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

Shared Stops Validator SS_01: only consider stops from feed being checked #588

Merged
merged 2 commits into from
Feb 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,19 @@ public void validate() {

// Check for SS_01 (stop id appearing in multiple stop groups).
// Make sure this error is only returned if we are inside the feed that is being checked.
if (seenStopIds.contains(stopId)) {
if (feedId.equals(sharedStopFeedId)) {
Stop syntheticStop = new Stop();
syntheticStop.stop_id = stopId;
if (feedId.equals(sharedStopFeedId)) {
if (seenStopIds.contains(stopId)) {
registerError(stops
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm pretty sure this can be simplified to the following because syntheticStop equals stopId:

registerError(syntheticStop, NewGTFSErrorType.MULTIPLE_SHARED_STOPS_GROUPS);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We prefer not using synthetic stop if possible, since synthetic stop can't link to the editor

.stream()
.filter(stop -> stop.stop_id.equals(stopId))
.findFirst()
.orElse(new Stop()), NewGTFSErrorType.MULTIPLE_SHARED_STOPS_GROUPS
.orElse(syntheticStop), NewGTFSErrorType.MULTIPLE_SHARED_STOPS_GROUPS
);
} else {
seenStopIds.add(stopId);
}
} else {
seenStopIds.add(stopId);
}

// Check for SS_02 (multiple primary stops per stop group).
Expand Down
Loading