mirror of https://github.com/jumpserver/jumpserver
perf: Report localtime
parent
bf92c756d4
commit
bd1d73c6dd
|
@ -62,7 +62,8 @@ class ChangeSecretDashboardApi(APIView):
|
|||
status_counts = defaultdict(lambda: defaultdict(int))
|
||||
|
||||
for date_finished, status in results:
|
||||
date_str = str(date_finished.date())
|
||||
dt_local = timezone.localtime(date_finished)
|
||||
date_str = str(dt_local.date())
|
||||
if status == ChangeSecretRecordStatusChoice.failed:
|
||||
status_counts[date_str]['failed'] += 1
|
||||
elif status == ChangeSecretRecordStatusChoice.success:
|
||||
|
|
|
@ -5,6 +5,7 @@ from collections import defaultdict
|
|||
from django.db.models import Count, Q, F, Value
|
||||
from django.db.models.functions import Concat
|
||||
from django.http import JsonResponse
|
||||
from django.utils import timezone
|
||||
from rest_framework.views import APIView
|
||||
|
||||
from accounts.const import Source
|
||||
|
@ -39,7 +40,8 @@ class AccountStatisticApi(DateRangeMixin, APIView):
|
|||
|
||||
data = defaultdict(set)
|
||||
for t, _id in filtered_queryset.values_list('date_change_secret', 'id'):
|
||||
date_str = str(t.date())
|
||||
dt_local = timezone.localtime(t)
|
||||
date_str = str(dt_local.date())
|
||||
data[date_str].add(_id)
|
||||
|
||||
metrics = [len(data.get(str(d), set())) for d in self.date_range_list]
|
||||
|
|
Loading…
Reference in New Issue