From 7f25b6311d3d89ce44761998aad1e43112234cfb Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 22 Jul 2021 00:01:28 +0200 Subject: [PATCH] web/admin: fix negative count for policies when more cached than total policies Signed-off-by: Jens Langhammer --- web/src/pages/admin-overview/charts/PolicyStatusChart.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/src/pages/admin-overview/charts/PolicyStatusChart.ts b/web/src/pages/admin-overview/charts/PolicyStatusChart.ts index 6adf4d7b0..baecd2efc 100644 --- a/web/src/pages/admin-overview/charts/PolicyStatusChart.ts +++ b/web/src/pages/admin-overview/charts/PolicyStatusChart.ts @@ -42,7 +42,9 @@ export class PolicyStatusChart extends AKChart { })).pagination.count; this.centerText = count.toString(); return { - count: count - cached - unbound, + // If we have more cache than total policies, only show that + // otherwise show count without unbound + count: cached >= count ? cached : count - unbound, cached: cached, unbound: unbound, };