fix: report

pull/15804/merge
feng 2025-08-12 19:13:56 +08:00 committed by ZhaoJiSen
parent 24bd7b7e1a
commit d9d034488f
2 changed files with 7 additions and 2 deletions

View File

@ -7,6 +7,7 @@ from django.db.models.functions import Concat
from django.http import JsonResponse
from rest_framework.views import APIView
from accounts.const import Source
from accounts.models import Account, AccountTemplate
from assets.const import Connectivity
from common.permissions import IsValidLicense
@ -58,7 +59,7 @@ class AccountStatisticApi(DateRangeMixin, APIView):
stats['template_total'] = self.template_qs.count()
source_pie_data = [
{'name': str(source), 'value': total}
{'name': str(Source(source).label), 'value': total}
for source, total in
qs.values('source').annotate(
total=Count(1)

View File

@ -3,6 +3,7 @@
from collections import defaultdict
from django.http import JsonResponse
from django.utils.translation import gettext_lazy as _
from rest_framework.views import APIView
from accounts.const import AutomationTypes
@ -63,7 +64,10 @@ class AccountAutomationApi(DateRangeMixin, APIView):
metrics = {}
for tp, values in tp_map.items():
_tp = AutomationTypes(tp).label
if tp == AutomationTypes.change_secret:
_tp = _('Account change secret')
else:
_tp = AutomationTypes(tp).label
metrics[str(_tp)] = values
return metrics