From 66505915a7c8ef8143b1410c33fe99baadf9e5d5 Mon Sep 17 00:00:00 2001 From: cal Date: Tue, 24 Mar 2026 12:11:18 +0000 Subject: [PATCH] fix: capture total_count before applying limit so response count reflects matching records not page size --- app/routers_v2/notifications.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/routers_v2/notifications.py b/app/routers_v2/notifications.py index 7a6053c..03f67a2 100644 --- a/app/routers_v2/notifications.py +++ b/app/routers_v2/notifications.py @@ -62,6 +62,8 @@ async def get_notifs( if ack is not None: all_notif = all_notif.where(Notification.ack == ack) + total_count = all_notif.count() + if limit is not None: all_notif = all_notif.limit(limit) @@ -87,7 +89,7 @@ async def get_notifs( return Response(content=return_val, media_type="text/csv") else: - return_val = {"count": all_notif.count(), "notifs": []} + return_val = {"count": total_count, "notifs": []} for x in all_notif: return_val["notifs"].append(model_to_dict(x))