-
Notifications
You must be signed in to change notification settings - Fork 20
fix page 0 and 1 returning same results #233
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
Conversation
WalkthroughThe changes update the pagination logic in four functions that construct SQL queries with LIMIT and OFFSET clauses. The offset calculation now uses Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant Storage
Caller->>Storage: Call function with Page and Limit
Storage->>Storage: Calculate offset as Page * Limit (Page >= 0)
Storage->>Storage: Build SQL query with LIMIT and OFFSET
Storage-->>Caller: Return query results
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (4)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
TL;DR
Fixed pagination logic to use zero-based indexing consistently across all query methods.
What changed?
qf.Page > 0
toqf.Page >= 0
in multiple query methods(qf.Page - 1) * qf.Limit
toqf.Page * qf.Limit
in methods where it was still using one-based indexingHow to test?
page=0
parameterWhy make this change?
The codebase had inconsistent pagination logic - some methods were using zero-based indexing while others used one-based indexing. This inconsistency could cause confusion for API consumers and potential bugs. This change standardizes all pagination to use zero-based indexing, which is more conventional in programming and aligns with common API practices.
Summary by CodeRabbit