mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-01-19 22:27:59 +01:00
fix offset calculation
This commit is contained in:
parent
4bf223fe1a
commit
039db5a329
1 changed files with 3 additions and 4 deletions
|
@ -35,11 +35,10 @@ defmodule PhilomenaWeb.Image.NavigateController do
|
|||
redirect(conn, to: Routes.image_path(conn, :index, page: page_num))
|
||||
end
|
||||
|
||||
defp page_for_offset(_per_page, 0), do: 1
|
||||
defp page_for_offset(per_page, offset) do
|
||||
((offset + 1) / per_page)
|
||||
|> Float.ceil()
|
||||
|> trunc()
|
||||
offset
|
||||
|> div(per_page)
|
||||
|> Kernel.+(1)
|
||||
|> to_string()
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue