Resolves #1663 by updating StopZoneIdValidator to issue notice about a stop without zone_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 without zone_id defined if any fare rules had zone fields defined.
The warning is still only triggered for stops where location_type is 0.
Zone fields in fare_rules.txt are origin_id, destination_id, and contains_id.
Adds tests to 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_type0 does not have a zone_id defined, and that stop is defined as part of a trip in stop_times.txt, and that trip is defined as part of a route in trips.txt, and that route is defined in a fare rule in fare_rules.txt, and that fare rule has any of origin_id, destination_id, or contains_id defined, then a stop_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 that zone_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.
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 on test feed with fix:
Please make sure these boxes are checked before submitting your pull request - thanks!
gradle test
to make sure you didn't break anything