flask-mongoengine icon indicating copy to clipboard operation
flask-mongoengine copied to clipboard

Pagination: incorrect next_num value when no records are returned

Open mihir19 opened this issue 4 years ago • 1 comments

Example:

def view_todos(page=1): paginated_todos = Todo.objects.paginate(page=page, per_page=10)

Assumption : Todo doesn't have any records in database

Result:

As page = 1, next_num=2 : https://github.com/MongoEngine/flask-mongoengine/blob/93bd9b9b8803ffae1ca9dd6435c2108c02a0403e/flask_mongoengine/pagination.py#L78

mihir19 avatar Sep 16 '20 18:09 mihir19

Hey, the issue is property next_num is just incrementing the page number without validating whether its property has_next is true or false. I would like to work on this issue. Can you please assign it to me so I can get started? Thank you!

MQ-xz avatar Apr 10 '23 06:04 MQ-xz