Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
efc310acad |
No files matched your search
@@ -125,9 +125,10 @@
|
||||
</details>
|
||||
{% endif %}
|
||||
|
||||
{% set profile_sections = employee_view.sections | rejectattr('type', 'in', ['news', 'additional_education']) | list %}
|
||||
{% if profile_sections or not employee_view.sections %}
|
||||
<section class="employee-card__section">
|
||||
<h3 class="employee-section__title">Разделы профиля</h3>
|
||||
{% set profile_sections = employee_view.sections | rejectattr('type', 'equalto', 'news') | list %}
|
||||
{% if profile_sections %}
|
||||
<div class="employee-card__sections">
|
||||
{% for section in profile_sections %}
|
||||
@@ -216,9 +217,6 @@
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
{% if section.type == "additional_education" and section.list_items %}
|
||||
<p class="employee-section__note">Распознано записей: {{ section.list_items | length }}</p>
|
||||
{% endif %}
|
||||
{% if section.paragraphs %}
|
||||
{% for paragraph in section.paragraphs %}
|
||||
<p class="employee-section__text">{{ paragraph }}</p>
|
||||
@@ -243,10 +241,11 @@
|
||||
</article>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% elif not employee_view.sections %}
|
||||
<p class="employee-section__text">Разделы профиля не найдены.</p>
|
||||
{% endif %}
|
||||
</section>
|
||||
{% endif %}
|
||||
</section>
|
||||
|
||||
{% include "employee_dpo.html" %}
|
||||
|
||||
@@ -11,9 +11,22 @@
|
||||
</fieldset>
|
||||
{% endmacro %}
|
||||
<section class="panel" id="unresolved-dpo" tabindex="-1">
|
||||
<h2 class="panel__title">Дополнительное профессиональное образование</h2>
|
||||
{% if employee_view.dpo_courses %}
|
||||
<ul class="employee-card__list">
|
||||
{% for course in employee_view.dpo_courses %}
|
||||
<li class="employee-card__list-item">{{ course.title }}{% if review %} · {{ kinds[course.kind] }}{% if course.year %} · {{ course.year }}{% endif %}{% if course.evidence %} · {{ course.evidence }}{% endif %}{% endif %}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% elif review %}<p>Курсов ДПО нет.</p>
|
||||
{% elif employee_view.dpo_uncertain %}<p>Отдельные курсы ДПО не распознаны.</p>
|
||||
{% else %}<p>Сведения о курсах ДПО отсутствуют.</p>{% endif %}
|
||||
{% if employee_view.dpo_uncertain %}
|
||||
<h3>Количество ДПО требует проверки</h3>
|
||||
{% if review %}<p>Сведения о ДПО изменились. В справочнике учтён последний подтверждённый список.</p>{% endif %}
|
||||
{% endif %}
|
||||
<details><summary>Редактировать список ДПО</summary>
|
||||
{% if employee_view.dpo_uncertain %}
|
||||
{% for section in employee_view.sections if section.type == 'additional_education' %}
|
||||
<h4>{{ section.title }} · сведения профиля</h4>
|
||||
{% if not section.list_items %}<p>В разделе ДПО не удалось выделить отдельные записи.</p>{% endif %}
|
||||
@@ -21,8 +34,12 @@
|
||||
{% for text in section.unresolved %}<p>{{ text }}</p>{% endfor %}
|
||||
{% for doc in section.unresolved_documents %}<p>{% if doc.url.startswith(('https://', 'http://')) %}<a class="admin__link" href="{{ doc.url }}">{{ doc.text }}</a>{% else %}{{ doc.text }}{% endif %}</p>{% endfor %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<details {% if employee_view.dpo_uncertain %}open{% endif %}><summary>Проверить список ДПО</summary>
|
||||
{% endif %}
|
||||
{% for section in employee_view.sections if section.type == 'additional_education' %}
|
||||
{% for link in section.links %}
|
||||
{% if link.url.startswith(('https://', 'http://')) %}<a class="admin__link" href="{{ link.url }}">{{ link.text }}</a>{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
<form data-dpo method="post" action="/admin/employees/{{ employee.id }}/dpo" data-source="{{ employee_view.dpo_source }}" data-revision="{{ review.revision if review else 0 }}">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<p>Оставьте по одной строке на каждое прохождение курса. Если удостоверение дублирует курс, перенесите его в основание и исключите лишнюю строку.</p>
|
||||
|
||||
+3
-3
@@ -1,3 +1,3 @@
|
||||
APP_VERSION = "2.4.1"
|
||||
FRONTEND_VERSION = "2.4.1"
|
||||
BACKEND_VERSION = "2.4.1"
|
||||
APP_VERSION = "2.4.2"
|
||||
FRONTEND_VERSION = "2.4.2"
|
||||
BACKEND_VERSION = "2.4.2"
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "miem-workers"
|
||||
version = "2.4.1"
|
||||
version = "2.4.2"
|
||||
description = "MIEM employees parser, admin API, and web admin"
|
||||
requires-python = ">=3.11"
|
||||
dependencies = [
|
||||
|
||||
+1
-1
@@ -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.1"
|
||||
assert response.json()["backend_version"] == "2.4.2"
|
||||
|
||||
|
||||
def test_api_employees_and_stats_require_admin_session():
|
||||
|
||||
@@ -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.1 · Frontend 2.4.1" in response.text
|
||||
assert "Backend 2.4.2 · Frontend 2.4.2" 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
|
||||
|
||||
+19
-6
@@ -429,13 +429,13 @@ def test_postgres_concurrent_admin_demotions_keep_an_admin(accounts):
|
||||
other.close()
|
||||
|
||||
|
||||
def test_reader_confirms_dpo_and_changed_sources_require_review(accounts):
|
||||
def test_reader_confirms_dpo_and_changed_sources_require_review(accounts, monkeypatch):
|
||||
from io import BytesIO
|
||||
from openpyxl import load_workbook
|
||||
from app.services.admin_data import employee_detail_payload, list_employees_page
|
||||
from app.services.directory_export import directory_xlsx
|
||||
|
||||
client, db, settings, _, user, employee = accounts
|
||||
client, db, settings, admin, user, employee = accounts
|
||||
headers = act_as(client, user, settings)
|
||||
url = f"/admin/employees/{employee.id}/dpo"
|
||||
title = "Работа с данными, повышение квалификации"
|
||||
@@ -455,7 +455,9 @@ def test_reader_confirms_dpo_and_changed_sources_require_review(accounts):
|
||||
assert client.post(url, json=payload, headers=headers).status_code == 409
|
||||
panel = BeautifulSoup(client.get(url[:-4]).text, "html.parser").select_one("#unresolved-dpo")
|
||||
assert "Подтверждено курсов" not in panel.get_text()
|
||||
assert panel.select_one("ol") is None
|
||||
assert "Инженерная практика" in panel.select_one(":scope > ul").get_text()
|
||||
assert title not in panel.get_text()
|
||||
assert panel.select_one("summary").get_text() == "Редактировать список ДПО"
|
||||
assert panel.select_one("[data-rows] input[name=title]")["value"] == "Инженерная практика"
|
||||
assert not employee_detail_payload(employee)["dpo_uncertain"]
|
||||
result = list_employees_page(db, training_since_year=2025)["employees"]
|
||||
@@ -465,9 +467,20 @@ def test_reader_confirms_dpo_and_changed_sources_require_review(accounts):
|
||||
employee.current_data = {"sections": [section], "phone": "changed"}
|
||||
db.commit()
|
||||
assert not employee_detail_payload(employee)["dpo_uncertain"]
|
||||
employee.current_data = {"sections": [{"type": "additional_education", "education_format": 2,
|
||||
"items": ["Новый курс"]}]}
|
||||
db.commit()
|
||||
refreshed_section = {**section, "items": ["Новый курс"], "year_entries": []}
|
||||
monkeypatch.setattr("app.services.crawler.parse_person_profile", lambda *args, **kwargs: {
|
||||
"profile_type": "users", "profile_id": "employee", "source_url": employee.canonical_url,
|
||||
"full_name": employee.full_name, "sections": [refreshed_section]})
|
||||
refreshed = client.post(url[:-4] + "/refresh", headers=act_as(client, admin, settings))
|
||||
assert refreshed.status_code == 200 and "refresh_status=success" in str(refreshed.url)
|
||||
headers = act_as(client, user, settings)
|
||||
card = BeautifulSoup(client.get(url[:-4]).text, "html.parser")
|
||||
panel = card.select_one("#unresolved-dpo")
|
||||
assert "Инженерная практика" in panel.select_one(":scope > ul").get_text()
|
||||
assert "Новый курс" not in panel.select_one(":scope > ul").get_text()
|
||||
assert "Новый курс" in panel.select_one("details").get_text()
|
||||
assert not any("Новый курс" in item.get_text() for item in card.select("article.employee-section"))
|
||||
assert panel.select_one("[data-rows] input[name=title]")["value"] == "Инженерная практика"
|
||||
view = employee_detail_payload(employee)
|
||||
assert view["dpo_uncertain"] and view["dpo_count"] == 1
|
||||
payload.update(courses=[], revision=1, confirm_empty=True)
|
||||
|
||||
Reference in new issue
Block a user