Skip to content

Commit

Permalink
Update max_page to be always > 0
Browse files Browse the repository at this point in the history
  • Loading branch information
thebugcatcher committed Oct 8, 2018
1 parent fa74ce0 commit 926c1b4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/rummage_ecto/hooks/paginate.ex
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ defmodule Rummage.Ecto.Hook.Paginate do
|> (& &1 / per_page).()
|> Float.ceil()
|> trunc()
max_page = max_page == 0 && 1 || max_page

%{page: Map.get(paginate_params, :page),
per_page: per_page, total_count: total_count, max_page: max_page}
Expand Down

0 comments on commit 926c1b4

Please sign in to comment.