Skip to content

Commit 53b5f01

Browse files
committed
šŸ› Fix pagination entry count bug
Addresses a bug whereby if the count requested was greater than the pagination limit, rather than using the limit the user count was still passed meaning duplication of entries
1 parent d6ce062 commit 53b5f01

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ā€Žsimvue/api/request.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,18 @@ def get_paginated(
303303
server response
304304
"""
305305
_offset: int = offset or 0
306+
307+
# Restrict the number of entries retrieved to be paginated,
308+
# if the count requested is below page limit use this value
309+
# else if undefined or greater than the page limit use the limit
310+
_request_count: int = min(count or MAX_ENTRIES_PER_PAGE, MAX_ENTRIES_PER_PAGE)
311+
306312
while (
307313
_response := get(
308314
url=url,
309315
headers=headers,
310316
params=(params or {})
311-
| {"count": count or MAX_ENTRIES_PER_PAGE, "start": _offset},
317+
| {"count": _request_count, "start": _offset},
312318
timeout=timeout,
313319
json=json,
314320
)

0 commit comments

Comments
Ā (0)