From 99305c17e71f3cee6a4a818e702513809324851b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Mon, 30 Dec 2024 16:50:42 +0100 Subject: [PATCH] Refactor user filtering in DeployedServiceStatsCollector to include only valid user services --- server/src/uds/workers/stats_collector.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/server/src/uds/workers/stats_collector.py b/server/src/uds/workers/stats_collector.py index 462b24d1a..52e36db98 100644 --- a/server/src/uds/workers/stats_collector.py +++ b/server/src/uds/workers/stats_collector.py @@ -94,9 +94,7 @@ class DeployedServiceStatsCollector(Job): total_users, total_assigned, total_users_with_service = 0, 0, 0 for auth in models.Authenticator.objects.all(): - fltr_user = auth.users.filter(userServices__isnull=False).exclude( - userServices__state__in=types.states.State.INFO_STATES - ).order_by() + fltr_user = auth.users.filter(userServices__state__in=types.states.State.VALID_STATES).order_by() users = auth.users.all().count() users_with_service = fltr_user.values('id').distinct().count() # Use "values" to simplify query (only id) number_assigned_services = fltr_user.values('id').count()