fix: present web timestamps in UTC+3

This commit is contained in:
nyan404 committed 2026-09-01 01:51:29 +03:00
1 parent 00bbe66c77
commit cffaaac755
8 files changed
+25 -18

No files matched your search

+3 -3
View File
@@ -16,7 +16,7 @@ from urllib.parse import parse_qs, unquote, urlparse
from .belki.api import ApiError, calculate_and_store, calculate_payload, inspect_bulk_payload, resolve_identity_payload
from .belki.history import CalculationStore
from .belki.applications import ApplicationError, ApplicationStore, validate_application
from .belki.admin_filters import matches_period, period_bounds
from .belki.admin_filters import WEB_TIMEZONE, matches_period, period_bounds
from .belki.google_sheets_export import GoogleSheetsExportService
from .belki.identity import IdentityDirectory
from .belki.image_host import ImageHostClient, ImageHostError
@@ -407,7 +407,7 @@ class Handler(BaseHTTPRequestHandler):
return
records = [item for item in history_store().list_calculations(sort_by="escort_id", descending=True, limit=500) if matches_period(item, *bounds) and report_matches_filters(item, query)]
rows = [[item["id"], datetime.fromisoformat(str(item["created_at"]).replace("Z", "+00:00")), item["mode"], item["source"], item["actor_id"], item["message"]] for item in records]
self._xlsx("belki-reports.xlsx", build_xlsx(sheet_name="Отчёты", headers=["ID", "Создан", "Тип", "Источник", "Автор", "Отчёт"], rows=rows))
self._xlsx("belki-reports.xlsx", build_xlsx(sheet_name="Отчёты", headers=["ID", "Создан (UTC+3)", "Тип", "Источник", "Автор", "Отчёт"], rows=rows, display_timezone=WEB_TIMEZONE))
return
if path == "/api/admin/applications":
if not self._admin_authorized():
@@ -429,7 +429,7 @@ class Handler(BaseHTTPRequestHandler):
return
records = [item for item in application_store().list(status=status) if matches_period(item, *bounds)]
rows = [[item["id"], datetime.fromisoformat(str(item["created_at"]).replace("Z", "+00:00")), item["status"], item["source"], item["application"].get("type", ""), item["application"].get("name", ""), item["application"].get("character_id")] for item in records]
self._xlsx("belki-applications.xlsx", build_xlsx(sheet_name="Заявки", headers=["ID", "Создана", "Статус", "Источник", "Тип", "Имя", "ID персонажа"], rows=rows))
self._xlsx("belki-applications.xlsx", build_xlsx(sheet_name="Заявки", headers=["ID", "Создана (UTC+3)", "Статус", "Источник", "Тип", "Имя", "ID персонажа"], rows=rows, display_timezone=WEB_TIMEZONE))
return
requested = unquote(path).lstrip("/")
candidate = (WEB_ROOT / requested).resolve()