Fix: When List Kbs some times the total is wrong (#8151)
### What problem does this PR solve? for kb.app list method when owner_ids the total calculate is wrong (now will base on the paged result to calculate total) ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
60ab7027c0
commit
e6f68e1ccf
1 changed files with 1 additions and 1 deletions
|
|
@ -185,9 +185,9 @@ def list_kbs():
|
||||||
tenants, current_user.id, 0,
|
tenants, current_user.id, 0,
|
||||||
0, orderby, desc, keywords, parser_id)
|
0, orderby, desc, keywords, parser_id)
|
||||||
kbs = [kb for kb in kbs if kb["tenant_id"] in tenants]
|
kbs = [kb for kb in kbs if kb["tenant_id"] in tenants]
|
||||||
|
total = len(kbs)
|
||||||
if page_number and items_per_page:
|
if page_number and items_per_page:
|
||||||
kbs = kbs[(page_number-1)*items_per_page:page_number*items_per_page]
|
kbs = kbs[(page_number-1)*items_per_page:page_number*items_per_page]
|
||||||
total = len(kbs)
|
|
||||||
return get_json_result(data={"kbs": kbs, "total": total})
|
return get_json_result(data={"kbs": kbs, "total": total})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return server_error_response(e)
|
return server_error_response(e)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue