Transport
Transport copied to clipboard
Limit is buggy
http://localhost/transport/web/api.php/v1/connections?from=bern&to=z%C3%BCrich&date=2012-04-08&time=18:40&limit=4
This returns 5 connections instead of 4.
This happens if two and more trains departure at the same time. Debugged this with @gwrtheyrn. The limit only specifies departure times not connections. Feature or bug? The same issue is visible on sbb.ch for the given connection.
If this is a feature of the Hafas api, nothing has to be changed. If this is a bug, an array_splice should do the trick.
We documented this behavior for the /stationboard call already: http://transport.opendata.ch/#stationboard
I'm pretty sure this is a hafas feature, and I'd leave it as is, since otherwise we'd have to make a decision on which connection is less important and can be cut off.
I think this would be pretty easy, the one that arrives at the destination earlier is more important than the one that takes longer.
I find the current behavior a little strange and think the API should fix that :)