Skip to content
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

Add support for number-based pagination #1139

Merged

Conversation

JPBergsma
Copy link
Contributor

In this PR I have added support for the page_number query parameter, as already mentioned in #1132.
I have also added a test for this.
I had not realized that I also had to add the IDs that are not in the response but do meet the requirements of the filter.
I therefore adjusted the 'check_response' function, so this is no longer necessary.
This also required changing another test.
Finally, I now also sort the response IDs as the sort in python could be done differently than the sort in the query.

@codecov
Copy link

codecov bot commented May 2, 2022

Codecov Report

Merging #1139 (d53cc06) into master (a6905b0) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #1139   +/-   ##
=======================================
  Coverage   92.41%   92.42%           
=======================================
  Files          68       68           
  Lines        3904     3909    +5     
=======================================
+ Hits         3608     3613    +5     
  Misses        296      296           
Flag Coverage Δ
project 92.42% <100.00%> (+<0.01%) ⬆️
validator 92.42% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
optimade/server/query_params.py 98.27% <ø> (ø)
...made/server/entry_collections/entry_collections.py 97.69% <100.00%> (+0.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a6905b0...d53cc06. Read the comment docs.

optimade/server/entry_collections/entry_collections.py Outdated Show resolved Hide resolved
optimade/server/query_params.py Outdated Show resolved Hide resolved
optimade/server/query_params.py Outdated Show resolved Hide resolved
@ml-evs ml-evs changed the title Add support for pagenumber/ IDS that are not returned no longer need to be specified in expected_ids Add support for number-based pagination May 2, 2022
optimade/server/entry_collections/entry_collections.py Outdated Show resolved Hide resolved
tests/server/middleware/test_query_param.py Outdated Show resolved Hide resolved
@ml-evs
Copy link
Member

ml-evs commented May 9, 2022

Just rebasing this PR to see how it interacts with #1141

@ml-evs ml-evs force-pushed the JPBergsma/add_support_page_number branch from 8fa1597 to 37cdf26 Compare May 9, 2022 09:53
@ml-evs
Copy link
Member

ml-evs commented May 9, 2022

Lots of GitHub actions failures this morning, will try again later.

@ml-evs ml-evs added enhancement New feature or request server Issues pertaining to the example server implementation labels May 9, 2022
Copy link
Member

@ml-evs ml-evs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor comment then I think this is ready! I will release 0.17.0 after this and another round of dependency PRs.

tests/server/conftest.py Show resolved Hide resolved
@ml-evs ml-evs force-pushed the JPBergsma/add_support_page_number branch 2 times, most recently from 21ab8af to ccaa99d Compare May 10, 2022 12:56
JPBergsma and others added 7 commits May 10, 2022 13:57
…in the case of paging so ids of documents that are not returned on this page do not have to be specified.
…hen the sorting takes place on a field other than id.
Co-authored-by: Matthew Evans <7916000+ml-evs@users.noreply.github.com>
…rs are supplied.

Co-authored-by: Matthew Evans <7916000+ml-evs@users.noreply.github.com>
- If a single ID is passed as a string, validate the request as a single
entry request
- If a single ID is passed within a list, validate it is a multi-entry
request that only returns one result
@ml-evs ml-evs force-pushed the JPBergsma/add_support_page_number branch from ccaa99d to d53cc06 Compare May 10, 2022 12:57
Copy link
Member

@ml-evs ml-evs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM now @JPBergsma, I will merge once the tests pass, then release 0.17!

@ml-evs ml-evs merged commit 66e675d into Materials-Consortia:master May 10, 2022
@JPBergsma JPBergsma deleted the JPBergsma/add_support_page_number branch May 10, 2022 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request server Issues pertaining to the example server implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants