fixed last_page err
This commit is contained in:
parent
e3eb8d2a5c
commit
3bb648786f
5
app.moon
5
app.moon
@ -61,9 +61,8 @@ class extends lapis.Application
|
|||||||
@page = tonumber(@params.page) or 1
|
@page = tonumber(@params.page) or 1
|
||||||
|
|
||||||
tracks = Tracks\paginated "* ORDER BY #{escape_identifier @order} #{@asc_desc}", per_page: 32
|
tracks = Tracks\paginated "* ORDER BY #{escape_identifier @order} #{@asc_desc}", per_page: 32
|
||||||
-- @last_page = tracks\num_pages! -- TODO figure out why this errors
|
-- @last_page = tracks\num_pages! -- this errors (something wrong with Lapis?)
|
||||||
@last_page = math.floor Tracks\count("true") / 32
|
@last_page = 1 + math.floor Tracks\count("true") / 32
|
||||||
-- @last_page = 150
|
|
||||||
-- validate page
|
-- validate page
|
||||||
if @page < 1
|
if @page < 1
|
||||||
return redirect_to: @url_for "tracks", order: @order, asc_desc: @asc_desc, page: 1
|
return redirect_to: @url_for "tracks", order: @order, asc_desc: @asc_desc, page: 1
|
||||||
|
Reference in New Issue
Block a user