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

Incorrect total in paging results from OffsetByPageNumberSpecification #408

Open
r0ss88 opened this issue Feb 15, 2024 · 2 comments
Open
Labels
bug Something isn't working help wanted Extra attention is needed up-for-grabs 🙏🏽 Happy to consider a pull review to address this issue

Comments

@r0ss88
Copy link

r0ss88 commented Feb 15, 2024

Describe the bug
When using the OffsetByPageNumberSpecification I've found that the total count returned does not reflect the total amount of items.
image

As we can see in the above query, the total number of items is 6 yet the total has been calculated as 67.

To Reproduce

  1. Add multiple types of items to the same container.
  2. Create a specification for one of the item types inheriting from OffsetbyPageNumberSpecification. You shouldn't need to add any where predicate to replicate.
  3. Call the specification with the Repository.QueryAsync method

Expected behavior
Total returned should be equal to the number of items of that type in the container

Actual behavior
Total returned will be equal to all the items in the container.

Additional context

The problem seems to stem from the count query being built without adding an additional filter for the "Type". There is obviously a simple workaround to this, modify every query to also include the type filter. However, this is implicitly done everywhere else by this package, so for that reason I deem this a bug.

@IEvangelist
Copy link
Owner

IEvangelist commented Feb 15, 2024

Great catch @r0ss88! It seems as though you're correct with this bug report, would you be interested in providing a pull request to fix this issue? I could assign this to you, if you're willing and able - just let me know.

@all-contributors please add @r0ss88 for bug.

Copy link
Contributor

@IEvangelist

I've put up a pull request to add @r0ss88! 🎉

@IEvangelist IEvangelist added bug Something isn't working help wanted Extra attention is needed up-for-grabs 🙏🏽 Happy to consider a pull review to address this issue labels Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed up-for-grabs 🙏🏽 Happy to consider a pull review to address this issue
Projects
None yet
Development

No branches or pull requests

2 participants