fix: localize admin UI and simplify employees navigation
This commit is contained in:
@@ -4,12 +4,21 @@ from app.models import CrawlRun, Employee
|
||||
from app.services.admin_data import (
|
||||
employee_detail_payload,
|
||||
employee_display_payload,
|
||||
format_admin_datetime,
|
||||
list_employees_page,
|
||||
run_payload,
|
||||
stats_payload,
|
||||
)
|
||||
|
||||
|
||||
def test_format_admin_datetime_handles_datetime_string_and_none():
|
||||
value = datetime(2026, 4, 28, 17, 13, 34, tzinfo=timezone.utc)
|
||||
|
||||
assert format_admin_datetime(value) == "28.04.2026 20:13"
|
||||
assert format_admin_datetime("2026-04-28T17:13:34.448605+00:00") == "28.04.2026 20:13"
|
||||
assert format_admin_datetime(None) == "Не указано"
|
||||
|
||||
|
||||
def test_employee_display_payload_extracts_common_fields(db_session):
|
||||
employee = Employee(
|
||||
profile_key="staff:person",
|
||||
@@ -32,9 +41,11 @@ def test_employee_display_payload_extracts_common_fields(db_session):
|
||||
payload = employee_display_payload(employee)
|
||||
|
||||
assert payload["positions_text"] == "Professor"
|
||||
assert payload["status_display"] == "Работает"
|
||||
assert payload["email_text"] == "person@hse.ru"
|
||||
assert payload["publications_count"] == 1
|
||||
assert payload["courses_count"] == 1
|
||||
assert payload["first_seen_display"] != "Не указано"
|
||||
|
||||
|
||||
def test_employee_detail_payload_normalizes_human_readable_sections(db_session):
|
||||
@@ -180,3 +191,4 @@ def test_run_payload_calculates_progress():
|
||||
|
||||
assert payload["processed_count"] == 5
|
||||
assert payload["progress_percent"] == 50.0
|
||||
assert payload["status_display"] == "Выполняется"
|
||||
|
||||
Reference in New Issue
Block a user