fix: forgot to return len() of list in function page_item_count. Insted list itself was returned
This commit is contained in:
parent
7e43f0d42d
commit
fa8b2b21f9
@ -28,9 +28,11 @@ class PaginationHelper:
|
||||
if page_index == 0:
|
||||
return len(self.collection[: self.items_per_page])
|
||||
|
||||
return self.collection[
|
||||
self.items_per_page * page_index : self.items_per_page * page_index * 2
|
||||
]
|
||||
return len(
|
||||
self.collection[
|
||||
self.items_per_page * page_index : self.items_per_page * page_index * 2
|
||||
]
|
||||
)
|
||||
|
||||
# determines what page an item at the given index is on. Zero based indexes.
|
||||
# this method should return -1 for item_index values that are out of range
|
||||
@ -38,8 +40,8 @@ class PaginationHelper:
|
||||
pass
|
||||
|
||||
|
||||
collection = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]
|
||||
collection = ["a", "b", "c", "d", "e", "f"]
|
||||
helper = PaginationHelper(collection, 4)
|
||||
|
||||
print(helper.page_count())
|
||||
print(helper.page_item_count(2))
|
||||
print(helper.page_item_count(1))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user