-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pagination not fully implemented #158
Comments
In particular, negative page numbers stopped working. |
This can be implemented using the pre= parameter for the subrequest to timetable.search.ch as described in https://oev.search.ch/api/help#route |
@CedricReichenbach I've implemented the negative pagination now with the |
@fabian Amazing! The standard case works perfectly well now. However, I just noticed that paging seems to be ignored if
and
To me, it looks like those params are just redirected to the search.ch API, so the issue might be there? |
The pagination doesn't seem to work correctly when a limit is set. The two links return exactly the same result:
Lower pages have overlapping results. It this a bug or am I using it wrong? |
@CedricReichenbach Hmm yes, can't see any obvious mistake in the code that would explain why |
@coffeemakr This is due to the limitations of https://timetable.search.ch/api/help#route. The max number of connections is 16: so the request for page 3 with limit 6 would need (3 + 1) * 6 = 24 results, which gets capped by timetable.search.ch. |
Ok, the Example: Since I couldn't find any proper place to report bugs, I submitted my findings through their support form. If anyone knows a better channel, please let me know. 🙂 |
The current behaviour of time_type=arrival is that num and pre arguments are switched. I agree that this is confusing and it should not be that way. |
@helbling Is there any ETA for this? If I'm not mistaken, it causes the current output of fahrplan.opendata.ch for paginated arrival times to be mostly nonsense. Just let me know if I can be of any assistance. |
It wasn't nonsense, it was just pre and num switched for time_type=arrival. |
Great, looks much better now! There's just one irregularity left: Pages 0 and -1 return the same results (on transport.opendata.ch). Further pages (1, 2, ... and -2, -3, ...) then work as expected by seamlessly providing later/earlier connections. This might have something to do with num=X returning X+4 results (on fahrplan.search.ch, e.g. this), as the "overlap" of connection in paging is exactly 4 as well. If I'm not mistaken, the current behavior is as follows:
Is this correct, and is this expected behavior? As far as I can tell, the current transport.opendata.ch implementation would expect something like that:
|
…aCH#158) The currently utilized fahrplan.search.ch API treats the "num" and "pre" parameters in a way such that they overlap by 4 connections: | num ---> <--- pre | -o-o-o-o-o-o-o-o-o-o- ^ time In order to respect this, we now skip the first 4 previous items, i.e. our page -1 starts at "pre=4".
…aCH#158) The currently utilized fahrplan.search.ch API treats the "num" and "pre" parameters in a way such that they overlap by 4 connections: | num ---> <--- pre | -o-o-o-o-o-o-o-o-o-o- ^ time In order to respect this, we now skip the first 4 previous items, i.e. our page -1 starts at "pre=4".
…185) * Prevent overlaps in pagination between future and past pages (#158) The currently utilized fahrplan.search.ch API treats the "num" and "pre" parameters in a way such that they overlap by 4 connections: | num ---> <--- pre | -o-o-o-o-o-o-o-o-o-o- ^ time In order to respect this, we now skip the first 4 previous items, i.e. our page -1 starts at "pre=4". * QA: Fix StyleCI errors (formatting and self-type usage)
With the pull request from @CedricReichenbach this should be resolved. Thanks! |
Pagination is currently not supported by https://timetable.search.ch/api/help#route
Currently implemented with a workaround by fetching max results and then slicing them: 75e962d
The text was updated successfully, but these errors were encountered: