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

(updates) Change the counter for the params loop #585

Merged
merged 1 commit into from
Feb 12, 2024

Conversation

spointu
Copy link
Contributor

@spointu spointu commented Feb 12, 2024

The params loop use the total of found items. But we need the count of elements in the array, which can be different from the total because of pagination.
The total can be 55, and the count from the array = 10 (because we display 10 elements per page).

The params loop use the total of found items. But we need the count of
elements in the array, which can be different from the total because of
pagination.
The total can be 55, and the count from the array = 10 (because we
display 10 elements per page).
@spointu spointu merged commit 834f657 into cnam-pre Feb 12, 2024
0 of 2 checks passed
@spointu spointu deleted the updates-pagination branch February 12, 2024 11:22
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

PR Type: Enhancement

PR Summary: This pull request addresses the need to accurately reflect the count of elements displayed per page in a paginated list, rather than using the total number of found items. This change is crucial for scenarios where the total number of items and the number of items displayed per page differ due to pagination.

Decision: Comment

📝 Type: 'Enhancement' - not supported yet.
  • Sourcery currently only approves 'Typo fix' PRs.
✅ Issue addressed: this change correctly addresses the issue or implements the desired feature.
No details provided.
📝 Complexity: the changes are too large or complex for Sourcery to approve.
  • Unsupported files: the diff contains files that Sourcery does not currently support during reviews.

General suggestions:

  • Ensure that the logic for calculating the count of elements per page is thoroughly tested, especially in edge cases where the number of items might be less than the per-page limit.
  • Consider adding documentation or comments in the code to explain why the count of elements in the array is used instead of the total found items, as this could be beneficial for future maintenance.
  • Review the implementation to ensure that it seamlessly integrates with existing pagination logic and does not introduce any regressions or unexpected behavior.

Thanks for using Sourcery. We offer it for free for open source projects and would be very grateful if you could help us grow. If you like it, would you consider sharing Sourcery on your favourite social media? ✨

Share Sourcery

Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

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.

2 participants