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

Random Pagination ISSUE-143 #147

Open
wants to merge 1 commit into
base: revamp
Choose a base branch
from

Conversation

MVarshini
Copy link
Collaborator

Random Pagination not working

Type of change

  • Refactor
  • New feature
  • Bug fix
  • Optimization
  • Documentation Update

Description

Pagination on clicking first and last buttons not working

Related Tickets & Documents

Checklist before requesting a review

  • I have performed a self-review of my code.
  • If it is a core feature, I have added thorough tests.

Testing

  • Please describe the System Under Test.
  • Please provide detailed steps to perform tests related to this code change.
  • How were the fix/results from this change verified? Please provide relevant screenshots or results.

Random Pagination not working
@@ -102,7 +102,7 @@ async def jobs(
"endDate": end_date.__str__(),
"results": results_df.to_dict("records"),
"total": jobsCount,
"offset": offset + size,
"offset": offset + size if size else 0,
Copy link
Collaborator

Choose a reason for hiding this comment

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

In some APIs (and you added some more with this PR), you're protecting against having offset set to a value without size. That's not the case here, and this expression isn't considering the value of offset. So if size we add offset + size (regardless of offset) or else use 0.

Is that what you meant? Should you be raising the HTTPException here if offset and not size?

>>> offset = 10
>>> size = None
>>> offset + size if size else 0
0
>>> offset + (size if size else 0)
10

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