Skip to content

Commit

Permalink
Fix offset logic
Browse files Browse the repository at this point in the history
  • Loading branch information
dhrdlicka committed Feb 5, 2024
1 parent a1f5922 commit cd52f8a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/swapi/util.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit cd52f8a

Please sign in to comment.