Skip to content

Commit

Permalink
Fix: add error for empty transfer count when leg group ids match
Browse files Browse the repository at this point in the history
  • Loading branch information
jsteelz committed Jul 4, 2022
1 parent 18b521c commit 478e646
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions fares_validator/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
INVALID_FARE_TRANSFER_TYPE = 'An entry in fare_transfer_rules.txt has fare_transfer_type with invalid value.'
INVALID_FROM_LEG_GROUP = 'A from_leg_group_id in fare_transfer_rules.txt is not defined in fare_leg_rules.txt.'
INVALID_TRANSFER_COUNT = 'An entry in fare_transfer_rules.txt has transfer_count with incorrect type or invalid integer value.'
EMPTY_TRANSFER_COUNT = 'An entry in fare_transfer_rules.txt has no transfer_count defined, but the from_ and to_ leg_group_ids are the same.'
INVALID_TO_LEG_GROUP = 'A to_leg_group_id in fare_transfer_rules.txt is not defined in fare_leg_rules.txt.'
NONEXISTENT_FILTER_FARE_PRODUCT_ID = 'A filter_fare_product referenced is not defined in fare_products.txt.'
TRANSFER_COUNT_WITH_BAD_LEGS = 'An entry in fare_transfer_rules.txt has transfer_count with different from and to leg group ids.'
2 changes: 2 additions & 0 deletions fares_validator/fare_transfer_rule_checkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def check_transfer_count(line):
line.add_error(INVALID_TRANSFER_COUNT)
except ValueError:
line.add_error(INVALID_TRANSFER_COUNT)
elif line.from_leg_group_id == line.to_leg_group_id:
line.add_error(EMPTY_TRANSFER_COUNT)


def check_durations(line):
Expand Down

0 comments on commit 478e646

Please sign in to comment.