Skip to content

Commit

Permalink
Pages should never be less than 0.
Browse files Browse the repository at this point in the history
Fixes #6765.
  • Loading branch information
bakert committed Nov 8, 2019
1 parent c604827 commit abcf2a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion decksite/api.py
Expand Up @@ -60,7 +60,7 @@ def decks_api() -> Response:
season_id = rotation.season_id(str(request.args.get('seasonId')), None)
where = query.decks_where(request.args, session.get('person_id'))
total = deck.load_decks_count(where=where, season_id=season_id)
pages = ceil(total / page_size) - 1 # 0-indexed
pages = max(ceil(total / page_size) - 1, 0) # 0-indexed
ds = deck.load_decks(where=where, order_by=order_by, limit=limit, season_id=season_id)
prepare_decks(ds)
r = {'page': page, 'pages': pages, 'decks': ds}
Expand Down

0 comments on commit abcf2a3

Please sign in to comment.