Fix maxPages off-by-one bug (#50)
The `pager.maxPages` calculation currently handles the case where there are fewer than `page_size` items to display but will cut off the final page for any page count larger than one. This change makes the page size the ceiling of the calculation in all cases.
This commit is contained in:
parent
498440f2c5
commit
accf8ecfa3
|
@ -243,7 +243,7 @@ sub ShowMovieOptions(library)
|
|||
pager = scene.findNode("pager")
|
||||
pager.currentPage = page_num
|
||||
pager.maxPages = item_list.TotalRecordCount / page_size
|
||||
if pager.maxPages = 0 then pager.maxPages = 1
|
||||
if item_list.TotalRecordCount mod page_size > 0 then pager.maxPages += 1
|
||||
|
||||
pager.observeField("escape", port)
|
||||
pager.observeField("pageSelected", port)
|
||||
|
@ -403,7 +403,7 @@ sub ShowTVShowOptions(library)
|
|||
pager = scene.findNode("pager")
|
||||
pager.currentPage = page_num
|
||||
pager.maxPages = item_list.TotalRecordCount / page_size
|
||||
if pager.maxPages = 0 then pager.maxPages = 1
|
||||
if item_list.TotalRecordCount mod page_size > 0 then pager.maxPages += 1
|
||||
|
||||
pager.observeField("escape", port)
|
||||
pager.observeField("pageSelected", port)
|
||||
|
@ -577,7 +577,7 @@ sub ShowCollections(library)
|
|||
pager = scene.findNode("pager")
|
||||
pager.currentPage = page_num
|
||||
pager.maxPages = item_list.TotalRecordCount / page_size
|
||||
if pager.maxPages = 0 then pager.maxPages = 1
|
||||
if item_list.TotalRecordCount mod page_size > 0 then pager.maxPages += 1
|
||||
|
||||
pager.observeField("escape", port)
|
||||
pager.observeField("pageSelected", port)
|
||||
|
|
Loading…
Reference in New Issue
Block a user