fix: capture total_count before applying limit so response count reflects matching records not page size
This commit is contained in:
parent
ac8ec4b283
commit
66505915a7
@ -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))
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user