Skip to content

Commit d50758d

Browse files
committed
Fix item pagination
1 parent 8ca0e88 commit d50758d

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/superannotate/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import sys
33

4-
__version__ = "4.4.1b4"
4+
__version__ = "4.4.1b5"
55

66
sys.path.append(os.path.split(os.path.realpath(__file__))[0])
77

src/superannotate/lib/infrastructure/services.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,9 +562,9 @@ def list_items(self, query_string) -> ServiceResponse:
562562
else:
563563
return _response
564564
data_len = len(_response.data)
565+
offset += data_len
565566
if _response.count < self.LIMIT or _response.count - offset <= 0:
566567
break
567-
offset += data_len
568568
response = ServiceResponse(_response)
569569
response.data = total
570570
return response

tests/integration/items/test_search_items.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ class TestSearchItems(BaseTestCase):
2121
def folder_path(self):
2222
return os.path.join(Path(__file__).parent.parent.parent, self.TEST_FOLDER_PATH)
2323

24+
def test_search_items_multiple(self):
25+
sa.attach_items(
26+
self.PROJECT_NAME,
27+
[{"name": str(i), "url": str(i)} for i in range(2003)]
28+
)
29+
items = sa.search_items(self.PROJECT_NAME)
30+
assert len(items) == 2003
31+
2432
def test_search_items_metadata(self):
2533
sa.upload_images_from_folder_to_project(
2634
self.PROJECT_NAME, self.folder_path, annotation_status="InProgress"

0 commit comments

Comments
 (0)