mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(nodes): fix off-by-one page count error
This commit is contained in:
parent
406039426a
commit
de0df4945d
@ -95,7 +95,10 @@ class DiskImageStorage(ImageStorageBase):
|
||||
|
||||
count = len(all_images)
|
||||
page_of_images = all_images[page * per_page : (page + 1) * per_page]
|
||||
page_count = int(count / per_page) + 1
|
||||
|
||||
page_count_trunc = int(count / per_page)
|
||||
page_count_mod = count % per_page
|
||||
page_count = page_count_trunc if page_count_mod == 0 else page_count_trunc + 1
|
||||
|
||||
return PaginatedResults[ImageField](
|
||||
items=page_of_images,
|
||||
|
@ -106,10 +106,12 @@ class SqliteItemStorage(ItemStorageABC, Generic[T]):
|
||||
finally:
|
||||
self._lock.release()
|
||||
|
||||
pageCount = int(count / per_page) + 1
|
||||
page_count_trunc = int(count / per_page)
|
||||
page_count_mod = count % per_page
|
||||
page_count = page_count_trunc if page_count_mod == 0 else page_count_trunc + 1
|
||||
|
||||
return PaginatedResults[T](
|
||||
items=items, page=page, pages=pageCount, per_page=per_page, total=count
|
||||
items=items, page=page, pages=page_count, per_page=per_page, total=count
|
||||
)
|
||||
|
||||
def search(
|
||||
|
Loading…
Reference in New Issue
Block a user