diff --git a/CHANGELOG.md b/CHANGELOG.md index 047aecc..6754d2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 2.4.3 + +- В справочнике и XLSX колонка с числом пройденных курсов называется «ДПО» и занимает меньше места. + ## 2.4.2 - Подтверждённые курсы ДПО остаются в карточке и редакторе после обновления профиля. Изменившиеся сведения источника доступны для сверки. diff --git a/app/services/admin_data.py b/app/services/admin_data.py index 762bd69..d2cd2c7 100644 --- a/app/services/admin_data.py +++ b/app/services/admin_data.py @@ -41,7 +41,7 @@ DIRECTORY_COLUMNS = ( ("last_seen_at", "Последний раз найден", "last_seen_display"), ("dismissed_at", "Дата увольнения", "dismissed_display"), ("profile", "Профиль", "canonical_url"), - ("dpo_count", "Количество ДПО", "dpo_count"), + ("dpo_count", "ДПО", "dpo_count"), ) _TRAINING_LABEL = "повышение квалификации" diff --git a/app/services/directory_export.py b/app/services/directory_export.py index 69193a7..0690cef 100644 --- a/app/services/directory_export.py +++ b/app/services/directory_export.py @@ -19,7 +19,7 @@ def directory_xlsx(employees: list[dict]) -> bytes: (employee[key] or "Без имени") if key == "full_name" else employee[key] for _, _, key in DIRECTORY_COLUMNS ]) - for cell, width in zip(sheet[1], (34, 20, 48, 14, 28, 22, 34, 30, 14, 10, 10, 22, 24, 22, 46, 18)): + for cell, width in zip(sheet[1], (34, 20, 48, 14, 28, 22, 34, 30, 14, 10, 10, 22, 24, 22, 46, 10)): cell.font = Font(bold=True) sheet.column_dimensions[get_column_letter(cell.column)].width = width sheet.freeze_panes = "A2" diff --git a/app/static/admin.css b/app/static/admin.css index b6533ff..8bfa246 100644 --- a/app/static/admin.css +++ b/app/static/admin.css @@ -796,6 +796,11 @@ vertical-align: top; } +.directory-table [data-column="dpo_count"] { + width: 4rem; + white-space: nowrap; +} + .directory-table .badge { white-space: nowrap; } diff --git a/app/version.py b/app/version.py index 42f14a5..8d1ee50 100644 --- a/app/version.py +++ b/app/version.py @@ -1,3 +1,3 @@ -APP_VERSION = "2.4.2" -FRONTEND_VERSION = "2.4.2" -BACKEND_VERSION = "2.4.2" +APP_VERSION = "2.4.3" +FRONTEND_VERSION = "2.4.3" +BACKEND_VERSION = "2.4.3" diff --git a/pyproject.toml b/pyproject.toml index 5073c44..f8c0ad6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "miem-workers" -version = "2.4.2" +version = "2.4.3" description = "MIEM employees parser, admin API, and web admin" requires-python = ">=3.11" dependencies = [ diff --git a/tests/test_api.py b/tests/test_api.py index 4e5b684..b163309 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -22,7 +22,7 @@ def test_health_returns_versions(): response = TestClient(app).get("/api/health") assert response.status_code == 200 - assert response.json()["backend_version"] == "2.4.2" + assert response.json()["backend_version"] == "2.4.3" def test_api_employees_and_stats_require_admin_session(): @@ -168,6 +168,10 @@ def test_directory_export_uses_applied_filters_and_sort_across_pages(db_session) status="dismissed" if number == 28 else "active", current_data={ "hse_start_year": 2025 - number, + "sections": [ + {"type": "courses_by_year", "courses": [{"title": "Физика"}]}, + {"type": "additional_education", "education_format": 2, "items": ["Курс А", "Курс Б"]}, + ], "positions": ["Инженер" if number == 29 else "Кафедра физики"], "contacts": {"address": "=1+1", "phones": ["+7 123"]}, }, @@ -202,6 +206,13 @@ def test_directory_export_uses_applied_filters_and_sort_across_pages(db_session) assert [cell.value for cell in sheet[1]] == [ cell.get_text(strip=True) for cell in page.select(".directory-table th") ] + assert page.select_one('th[data-column="dpo_count"]').get_text(strip=True) == "ДПО" + assert page.select_one('td[data-column="dpo_count"]').get_text(strip=True) == "2" + columns = {cell.value: cell for cell in sheet[1]} + dpo = columns["ДПО"] + assert sheet.cell(2, dpo.column).value == 2 + assert sheet.cell(2, columns["Преподаваемые курсы"].column).value == 1 + assert sheet.column_dimensions[dpo.column_letter].width == 10 assert sheet.max_column == 16 assert [cell.value for cell in sheet["A"][1:]] == [f"Export {number:02d}" for number in range(28)] assert [cell.value for cell in sheet["A"][-3:]] == [ diff --git a/tests/test_council.py b/tests/test_council.py index 6f19d09..4b6fe9e 100644 --- a/tests/test_council.py +++ b/tests/test_council.py @@ -230,7 +230,7 @@ def test_public_page_data_minimization_and_safe_links(db_session, export): assert "javascript:" not in fragment.text and "private@example.org" not in fragment.text assert "javascript:" not in response.text and "private@example.org" not in response.text assert "/admin/employees/" not in response.text and "/admin/logout" not in response.text - assert "Backend 2.4.2 · Frontend 2.4.2" in response.text + assert "Backend 2.4.3 · Frontend 2.4.3" in response.text assert "Вход в систему" in response.text assert client.get("/admin/directory", follow_redirects=False).status_code in (302, 303, 401, 403) assert "Сотрудники не найдены" in client.get("/admin/council?q=missing").text