Skip to content

Commit

Permalink
fix pagination logic
Browse files Browse the repository at this point in the history
  • Loading branch information
martinkatamba committed Jul 4, 2024
1 parent 403fe0f commit d21f9db
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions integrations/clickup/clickup/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,9 @@ async def get_paginated_tasks(
logger.info("Getting tasks (issues) from ClickUp")

params = self._generate_base_req_params()
total_tasks = (await self._get_tasks(list_id, params))["tasks"]

if not total_tasks:
logger.warning(
"Task query returned 0 tasks, did you provide the correct ClickUp API credentials and query parameters?"
)

page = 0
page = params.get("page",0)
while True:
params["page"] = page
logger.info(f"Current query position: page {page}")
try:
task_response = await self._get_tasks(list_id, params)
Expand All @@ -116,3 +109,4 @@ async def get_paginated_tasks(
logger.error(f"Failed to fetch tasks for page {page}: {e}")
break
page += 1
params["page"] = page

0 comments on commit d21f9db

Please sign in to comment.