diff --git a/lib/swapi/util.ex b/lib/swapi/util.ex index c0a0443..7f7b39d 100644 --- a/lib/swapi/util.ex +++ b/lib/swapi/util.ex @@ -33,7 +33,7 @@ defmodule SWAPI.Util do defp get_page_number(%{"offset" => offset}) when is_binary(offset) do case Integer.parse(offset) do :error -> {:error, :bad_request} - {offset, _} -> {:ok, div(offset, @page_size)} + {offset, _} -> {:ok, div(offset - 1, @page_size) + 1} end end