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

[spiral/pagination] Paginator doesn't calculate countPages correctly in constructor #900

Closed
gam6itko opened this issue Mar 16, 2023 · 1 comment · Fixed by #928
Closed
Assignees
Milestone

Comments

@gam6itko
Copy link
Contributor

gam6itko commented Mar 16, 2023

Description

The current implementation of the Paginator class has an issue in the constructor when we pass the $count argument. The problem is with the $countPages property which should be calculated based on the $count property, but it doesn't. This can cause incorrect pagination calculations.

Steps to Reproduce:

Create an instance of the Paginator class with a non-zero count argument

$paginator = new Paginator(limit: 25, count: 100);

Expected Result:

The countPages property should be calculated based on the count property and return the correct value.

$this->assertSame(100, $paginator->count());
$this->assertSame(4, $paginator->countPages());
@gam6itko gam6itko added the Bug label Mar 16, 2023
@butschster butschster added this to the 3.7 milestone Mar 16, 2023
@butschster butschster modified the milestones: 3.7, 3.8 Apr 18, 2023
@butschster butschster assigned butschster and unassigned msmakouz Apr 22, 2023
@butschster butschster modified the milestones: 3.8, 3.7.x Apr 22, 2023
@butschster butschster changed the title Paginator constructor argument count has no effect [spiral/pagination] Paginator doesn't calculate countPages correctly in constructor Apr 22, 2023
butschster added a commit that referenced this issue Apr 22, 2023
@butschster
Copy link
Member

Fixed

@butschster butschster modified the milestones: 3.7.x, 3.8 Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants