Skip to content

Commit 679f2be

Browse files
committed
Fix jsx pagination
1 parent 573f6c7 commit 679f2be

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/superannotate/lib/infrastructure/services/item_service.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def list(self, project_id: int, folder_id: Optional[int], query: Query):
9696
raise AppException("The filter is too complicated.")
9797
long_filter = long_filters[0]
9898
available_slots = available_slots - cumulative_length
99-
values = long_filter.value
99+
values = list(long_filter.value)
100100
results = []
101101
chunks = []
102102
current_chunk = []
@@ -110,6 +110,8 @@ def list(self, project_id: int, folder_id: Optional[int], query: Query):
110110
chunks.append(current_chunk)
111111
current_chunk = [val]
112112
char_counter = len(val)
113+
if current_chunk:
114+
chunks.append(current_chunk)
113115
for chunk in chunks:
114116
chunk_filter = Filter(long_filter.key, chunk, OperatorEnum.IN)
115117
chunk_query = copy.deepcopy(base_filter) & chunk_filter
@@ -126,7 +128,7 @@ def list(self, project_id: int, folder_id: Optional[int], query: Query):
126128
if not response.ok:
127129
raise AppException(response.error)
128130
results.extend(response.data)
129-
return results
131+
return results
130132
response = self.client.paginate(
131133
f"{base_uri}{query_string}",
132134
item_type=BaseItemEntity,

tests/integration/items/test_attach_items.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def test_long_names_limitation_pass(self):
109109
import time
110110

111111
time.sleep(4)
112-
items = sa.list_items(self.PROJECT_NAME)
112+
items = sa.list_items(self.PROJECT_NAME, name__in=[i["name"] for i in csv_json])
113113

114114
assert {i["name"] for i in items} == {i["name"] for i in csv_json}
115115

0 commit comments

Comments
 (0)