Fix bug in modelutil pagination that caused us to load far more results than necessary

Also adds tests for the modelutil pagination
This commit is contained in:
Joseph Schorr 2018-05-14 11:40:31 -04:00
parent e5b86d4763
commit 29058201e5
2 changed files with 51 additions and 2 deletions

View file

@ -25,9 +25,8 @@ def paginate(query, model, descending=False, page_token=None, limit=50, id_alias
query = query.where(model.id <= start_id)
else:
query = query.where(model.id >= start_id)
else:
query = query.limit(limit + 1)
query = query.limit(limit + 1)
return paginate_query(query, limit=limit, id_alias=id_alias)