fix: make stop_without_zone_id conditional on fare rule type (#1663) #1682
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.
Summary:
Resolves #1663 by updating
StopZoneIdValidator
to issue notice about a stop withoutzone_id
defined only when the stop is contained in a trip contained in a route defined in a fare rule with zone fields defined. Change from previous logic which warned about stops withoutzone_id
defined if any fare rules had zone fields defined.location_type
is0
.fare_rules.txt
areorigin_id
,destination_id
, andcontains_id
.StopZoneIdValidatorTest
to confirm expected behavior as described below.Note that a previous, nearly-identical version of this pull request was closed and abandoned because of issues with the commit email address and the CLA.
Expected behavior:
If a stop of
location_type
0
does not have azone_id
defined, and that stop is defined as part of a trip instop_times.txt
, and that trip is defined as part of a route intrips.txt
, and that route is defined in a fare rule infare_rules.txt
, and that fare rule has any oforigin_id
,destination_id
, orcontains_id
defined, then astop_without_zone_id
notice is issued.Exactly one notice is issued per stop that meets the criteria to issue a notice even if that stop meets the notice criteria through multiple combinations of trips, routes, and fare rules.
The notice is never issued if a stop has a
zone_id
defined, even if thatzone_id
is never defined in a zone field of a fare rule associated with the stop by the (stop_time > trip > route) chain described above.This pull request fixes the issue on the test feed provided by westontrillium in google/transit #429.
Validator results on test feed without fix:
![Validator results without fix](https://private-user-images.githubusercontent.com/152334970/309048073-887bdf88-96eb-49b6-a7ad-f80663fb60b4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEwNzA5NDIsIm5iZiI6MTcyMTA3MDY0MiwicGF0aCI6Ii8xNTIzMzQ5NzAvMzA5MDQ4MDczLTg4N2JkZjg4LTk2ZWItNDliNi1hN2FkLWY4MDY2M2ZiNjBiNC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzE1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcxNVQxOTEwNDJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1iYzgxY2ZiZmFiOGNkZjViYWNhMWNhYmQ3NmJjNTMxNmE5ZDE4NDJmYTFjMjBiYWQ5MjU1NGQxZWRlZDUyYWIxJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.oMvfLKhkogv--AbpJcZpGTjqtwB7nDmjFuVFcPapfJI)
Validator results on test feed with fix:
![Validator results with fix](https://private-user-images.githubusercontent.com/152334970/309048066-be7c11ad-6289-4e33-8161-3ab97cc3bc00.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEwNzA5NDIsIm5iZiI6MTcyMTA3MDY0MiwicGF0aCI6Ii8xNTIzMzQ5NzAvMzA5MDQ4MDY2LWJlN2MxMWFkLTYyODktNGUzMy04MTYxLTNhYjk3Y2MzYmMwMC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzE1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcxNVQxOTEwNDJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1iMDgwNWYxMzEwZTdjYWQ4M2EwZjlhMTEyNDM3NjQ2ZTM1ZDA3YzE4YWExNDZiNTQ4Yzc0ZTUzMDdmYTk3ZGJjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.1hHt3PBhlAy-kh2GmEz1Hr2YnE6GpkXbhOl65Z9oOXk)
Please make sure these boxes are checked before submitting your pull request - thanks!
gradle test
to make sure you didn't break anything