Don't expect every pattern in a route to have the specified stop with constrained transfers - #3868
Conversation
|
I'm not sure if I like the way I've fixed this issue. However, this was the easiest way to fix it but I'm more than happy to change it to something else. Below are some alternative ways to do it:
|
|
I would also prefer a solution that doesn't use exceptions as a control flow statements. Is this due to invalid input data or is this a legal state that we have to take into account when building the index? |
|
This is a legal state and it's even expected to happen quite often so logging when it happens doesn't really make sense |
f862ac5 to
263cd75
Compare
|
I rewrote it by returning -1 when stop is not on pattern. Should I add tests for this somewhere? |
|
Wasn't there any calling code that needed to be updated? |
Didn't seem like so. Most places called different method for finding stop index in the stop pattern. |
Summary
Adds validation for indexing constrained transfers so that it can handle situations where a route doesn't have a stop specified in a transfer in every pattern.
Issue
closes #3867
Unit tests
Should they be added?
Code style
Have you followed the suggested code style?
Yes
Documentation
not needed
Changelog
From title