OpendataCH / Transport

Swiss public transport API
http://transport.opendata.ch/
MIT License
241 stars 50 forks source link

Last connection shown with isArrivalTime=1 is unstable across different values of limit parameter #213

Open mbeer opened 2 years ago

mbeer commented 2 years ago

There is an unexpected behaviour when the connections request is used with isArrivalTime = 1 and different values of limit.

The request https://transport.opendata.ch/v1/connections?from=Bern&to=Luzern&date=2022-05-10&time=12:00&isArrivalTime=1&limit=1 returns one connection with arrival time 11:30 (2022-05-10T11:30:00+0200) – not the one with arrival time 11:55 as shown on search.ch.

The request https://transport.opendata.ch/v1/connections?from=Bern&to=Luzern&date=2022-05-10&time=12:00&isArrivalTime=1&limit=2 returns two connections with arrival times 10:55 and 11:01 respectively, but not those with arrival times 11:30 and 11:55.

The request https://transport.opendata.ch/v1/connections?from=Bern&to=Luzern&date=2022-05-10&time=12:00&isArrivalTime=1&limit=3 returns three connections with arrival times 09:55, 10:01 and 10:30 respectively, but not those with arrival times 11:01, 11:30, or 11:55.

The expected behaviour would be to get the connection with arrival time 11:55 as the last connection irrespective of the value chosen for limit.

This might be linked to the change introduced by #199.