Skip to content

Commit

Permalink
Merge pull request #387 from woylie/fix/range-warning
Browse files Browse the repository at this point in the history
fix warning about ranges in Elixir 1.18
  • Loading branch information
woylie authored Dec 13, 2024
2 parents f0d145d + 6a82abe commit 5e4ddd2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/flop_phoenix/pagination.ex
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ defmodule Flop.Phoenix.Pagination do

cond do
max_pages >= total_pages ->
1..total_pages
1..total_pages//1

current_page + additional > total_pages ->
(total_pages - max_pages + 1)..total_pages
(total_pages - max_pages + 1)..total_pages//1

true ->
first = max(current_page - additional + 1, 1)
last = min(first + max_pages - 1, total_pages)
first..last
first..last//1
end
end

Expand Down

0 comments on commit 5e4ddd2

Please sign in to comment.