diff --git a/apps/accounts/api/automations/change_secret_dashboard.py b/apps/accounts/api/automations/change_secret_dashboard.py index 4d6b71266..517809670 100644 --- a/apps/accounts/api/automations/change_secret_dashboard.py +++ b/apps/accounts/api/automations/change_secret_dashboard.py @@ -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: diff --git a/apps/reports/api/accouts/account.py b/apps/reports/api/accouts/account.py index c6a7ff5de..6b3d044dc 100644 --- a/apps/reports/api/accouts/account.py +++ b/apps/reports/api/accouts/account.py @@ -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]