Use of iterator_to_array in PaginatorAdapter for incorrect limit on dataset #666
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
After the update the number per page and the count per page is not matching anymore.
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.