From f9218584f4bae6dc628a0ef610785da72251ab98 Mon Sep 17 00:00:00 2001 From: xinwen Date: Wed, 18 Aug 2021 16:40:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BB=84=E7=BB=87=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E9=87=8C=E7=B3=BB=E7=BB=9F=E7=94=A8=E6=88=B7=E4=B8=8E=E7=89=B9?= =?UTF-8?q?=E6=9D=83=E7=94=A8=E6=88=B7=E6=95=B0=E9=87=8F=E4=B8=8D=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/orgs/caches.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/orgs/caches.py b/apps/orgs/caches.py index febbc64a9..3d4236b1c 100644 --- a/apps/orgs/caches.py +++ b/apps/orgs/caches.py @@ -54,8 +54,8 @@ class OrgResourceStatisticsCache(OrgRelatedCache): assets_amount = IntegerField() nodes_amount = IntegerField(queryset=Node.objects) - admin_users_amount = IntegerField(queryset=SystemUser.objects.filter(type=SystemUser.Type.admin)) - system_users_amount = IntegerField(queryset=SystemUser.objects.filter(type=SystemUser.Type.common)) + admin_users_amount = IntegerField() + system_users_amount = IntegerField() domains_amount = IntegerField(queryset=Domain.objects) gateways_amount = IntegerField(queryset=Gateway.objects) @@ -77,6 +77,12 @@ class OrgResourceStatisticsCache(OrgRelatedCache): def get_current_org(self): return self.org + def compute_admin_users_amount(self): + return SystemUser.objects.filter(type=SystemUser.Type.admin).count() + + def compute_system_users_amount(self): + return SystemUser.objects.filter(type=SystemUser.Type.common).count() + def compute_users_amount(self): users = User.objects.exclude(role='App')