From 9515f0cf87fe43f38acfe642852049d63fd5ff51 Mon Sep 17 00:00:00 2001 From: gabrielvmayer Date: Wed, 11 Mar 2026 21:06:50 -0300 Subject: [PATCH] fix: adjust pagination metadata when fetching projects with an assignee filter --- src/conviso/VERSION | 2 +- src/conviso/commands/projects.py | 29 ++++++++++++++++++++--------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/conviso/VERSION b/src/conviso/VERSION index c2c0004..449d7e7 100644 --- a/src/conviso/VERSION +++ b/src/conviso/VERSION @@ -1 +1 @@ -0.3.5 +0.3.6 diff --git a/src/conviso/commands/projects.py b/src/conviso/commands/projects.py index 2df1307..32a8b9f 100644 --- a/src/conviso/commands/projects.py +++ b/src/conviso/commands/projects.py @@ -206,27 +206,38 @@ def _fetch_page(page_num: int): typer.echo("⚠️ No projects found.") raise typer.Exit() + if fetch_all: + disp_page, disp_total_pages = 1, 1 + total = len(rows) + start, end = (1, total) if total > 0 else (0, 0) + else: + disp_page = page + disp_total_pages = total_pages or '?' + total = total_count or len(rows) + effective_limit = max(limit, 1) + start = (page - 1) * effective_limit + 1 if total > 0 else 0 + end = min(page * effective_limit, total) + export_data( rows, schema=schema, fmt=fmt, output=output, - title=f"Projects (Company {company_id}) - Page {page}/{total_pages or '?'}", + title=f"Projects (Company {company_id}) - Page {disp_page}/{disp_total_pages}", ) if fmt != "json": - total = total_count or len(rows) - effective_limit = max(limit, 1) - - start = (page - 1) * effective_limit + 1 if total > 0 else 0 - end = min(page * effective_limit, total) - - total_pages_calc = math.ceil(total / effective_limit) + if not fetch_all and disp_total_pages != '?': + total_pages_calc = disp_total_pages + elif fetch_all: + total_pages_calc = 1 + else: + total_pages_calc = math.ceil(total / max(limit, 1)) elapsed = time.perf_counter() - started_at timed_summary( f"Showing {start}-{end} of {total} " - f"(page {page}/{total_pages_calc})", + f"(page {disp_page}/{total_pages_calc})", elapsed, )