1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-04 05:17:54 +03:00

Refactor user filtering in DeployedServiceStatsCollector to include only valid user services

This commit is contained in:
Adolfo Gómez García 2024-12-30 16:50:42 +01:00
parent 9b3caed641
commit 99305c17e7
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23

View File

@ -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()