Skip to content

Use of iterator_to_array in PaginatorAdapter for incorrect limit on dataset #666

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

Open
wants to merge 1 commit into
base: 3.1.x
Choose a base branch
from

Conversation

jeroenzwart
Copy link

We encountered the following problem in our application after v3.0. In de pagination after the update the number per page and the count per page is not matching anymore. When a request is made with an per page of 10, the response can be incorrect when using include in the request.

For example; the response in the request with per page of 10 returns a result of 10 hamburgers. When we also want in the same request the ingredients, the include 'ingredients' is provided. Just to explain, for convenience, each hamburger has 2 related ingredients. When the same request with include is executed, the result is 5 hamburgers with each 2 ingredients. The sum of 'all items' in the response is 10, which is incorrect.

When each hamburger has 3 ingredients, the result will be 3 hamburgers with 3 ingredients, plus 1 hamburger without any ingredients. The meta data of the pagination is incorrect. When the include param is deleted from the request, the number per page and the count of items stays the same.


In our app, before the update, when you made a call to and endpoint with an include the number of items per page was the what you got from as response, and according to the pagination: {{HOST}}/periods?include=closed&per_page=9

afbeelding

After the update the number per page and the count per page is not matching anymore.

afbeelding

When the include param is deleted from the request, the number per page and the count of items stays the same.


Based on the last code changes, I found that the change on this method broke the results. By reverting it to the use of iterator_to_array the number of results stays the same as the items per page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant