Compare commits
13
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b604b21e4 | ||
|
|
f493e92087 | ||
|
|
7f3731452b | ||
|
|
ec0bd18177 | ||
|
|
962c3963c1 | ||
|
|
ea47efcf9d | ||
|
|
febddada12 | ||
|
|
09079081e9 | ||
|
|
0bbf82004b | ||
|
|
ed35996fd4 | ||
|
|
520c1df4f3 | ||
|
|
efc310acad | ||
|
|
b394650744 |
No files matched your search
@@ -1,5 +1,17 @@
|
||||
# Changelog
|
||||
|
||||
## 2.4.4
|
||||
|
||||
- В справочнике после должности по умолчанию видна колонка «ДПО». Сохранённый набор из ФИО, статуса, должности, преподаваемых курсов, даты обнаружения и профиля автоматически переходит на показ пройденных ДПО.
|
||||
|
||||
## 2.4.3
|
||||
|
||||
- В справочнике и XLSX колонка с числом пройденных курсов называется «ДПО» и занимает меньше места.
|
||||
|
||||
## 2.4.2
|
||||
|
||||
- Подтверждённые курсы ДПО остаются в карточке и редакторе после обновления профиля. Изменившиеся сведения источника доступны для сверки.
|
||||
|
||||
## 2.4.1
|
||||
|
||||
- В карточке сотрудника убрана служебная сводка подтверждения ДПО. Сохранённые курсы доступны в редакторе списка.
|
||||
|
||||
@@ -35,13 +35,13 @@ DIRECTORY_COLUMNS = (
|
||||
("address", "Адрес", "address"),
|
||||
("academic_degree", "Учёная степень", "academic_degree_text"),
|
||||
("publications_count", "Публикации", "publications_count"),
|
||||
("courses_count", "Преподаваемые курсы", "courses_count"),
|
||||
("dpo_count", "ДПО", "dpo_count"),
|
||||
("news_count", "Новости", "news_count"),
|
||||
("first_seen_at", "Впервые найден", "first_seen_display"),
|
||||
("last_seen_at", "Последний раз найден", "last_seen_display"),
|
||||
("dismissed_at", "Дата увольнения", "dismissed_display"),
|
||||
("profile", "Профиль", "canonical_url"),
|
||||
("dpo_count", "Количество ДПО", "dpo_count"),
|
||||
("courses_count", "Преподаваемые курсы", "courses_count"),
|
||||
)
|
||||
|
||||
_TRAINING_LABEL = "повышение квалификации"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -796,6 +796,11 @@
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.directory-table [data-column="dpo_count"] {
|
||||
width: 4rem;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.directory-table .badge {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
+8
-2
@@ -3,10 +3,11 @@
|
||||
"full_name",
|
||||
"status",
|
||||
"positions",
|
||||
"dpo_count",
|
||||
"last_seen_at",
|
||||
"profile",
|
||||
];
|
||||
const storageKey = "miem.directory.columns";
|
||||
const storageKey = "miem.directory.columns.v2";
|
||||
const columnPresets = {
|
||||
review: ["full_name", "status", "academic_degree", "last_seen_at", "profile"],
|
||||
contacts: ["full_name", "status", "email", "phone", "address", "profile"],
|
||||
@@ -15,7 +16,12 @@
|
||||
|
||||
function readColumns() {
|
||||
try {
|
||||
const stored = JSON.parse(localStorage.getItem(storageKey) || "[]");
|
||||
const current = localStorage.getItem(storageKey);
|
||||
const stored = JSON.parse(current ?? localStorage.getItem("miem.directory.columns") ?? "[]");
|
||||
if (current === null && Array.isArray(stored) && stored.length === columnDefaults.length &&
|
||||
columnDefaults.every((key) => stored.includes(key === "dpo_count" ? "courses_count" : key))) {
|
||||
return columnDefaults;
|
||||
}
|
||||
return Array.isArray(stored) && stored.length ? stored : columnDefaults;
|
||||
} catch (_error) {
|
||||
return columnDefaults;
|
||||
|
||||
@@ -117,13 +117,13 @@
|
||||
<td class="directory-table__cell" data-column="address">{{ employee.address or "" }}</td>
|
||||
<td class="directory-table__cell" data-column="academic_degree">{{ employee.academic_degree_text }}</td>
|
||||
<td class="directory-table__cell" data-column="publications_count">{{ employee.publications_count }}</td>
|
||||
<td class="directory-table__cell" data-column="courses_count">{{ employee.courses_count }}</td>
|
||||
<td class="directory-table__cell" data-column="dpo_count">{{ employee.dpo_count if employee.dpo_count is not none else "—" }}{% if employee.dpo_uncertain %} <a class="dpo-warning" href="/admin/employees/{{ employee.id }}#unresolved-dpo" title="Количество ДПО требует проверки" aria-label="Количество ДПО требует проверки"><span aria-hidden="true">⚠︎</span></a>{% endif %}</td>
|
||||
<td class="directory-table__cell" data-column="news_count">{{ employee.news_count }}</td>
|
||||
<td class="directory-table__cell" data-column="first_seen_at">{{ employee.first_seen_display }}</td>
|
||||
<td class="directory-table__cell" data-column="last_seen_at">{{ employee.last_seen_display }}</td>
|
||||
<td class="directory-table__cell" data-column="dismissed_at">{{ employee.dismissed_display }}</td>
|
||||
<td class="directory-table__cell" data-column="profile"><a class="admin__link" href="{{ employee.canonical_url }}" target="_blank" rel="noopener">Внешний профиль</a></td>
|
||||
<td class="directory-table__cell" data-column="dpo_count">{{ employee.dpo_count if employee.dpo_count is not none else "—" }}{% if employee.dpo_uncertain %} <a class="dpo-warning" href="/admin/employees/{{ employee.id }}#unresolved-dpo" title="Количество ДПО требует проверки" aria-label="Количество ДПО требует проверки"><span aria-hidden="true">⚠︎</span></a>{% endif %}</td>
|
||||
<td class="directory-table__cell" data-column="courses_count">{{ employee.courses_count }}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr><td class="directory-table__empty" colspan="{{ directory_columns|length }}">
|
||||
|
||||
@@ -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 | selectattr('type', 'equalto', 'additional_education') | list) %}
|
||||
<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>
|
||||
@@ -247,6 +245,7 @@
|
||||
<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.4"
|
||||
FRONTEND_VERSION = "2.4.4"
|
||||
BACKEND_VERSION = "2.4.4"
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "miem-workers"
|
||||
version = "2.4.1"
|
||||
version = "2.4.4"
|
||||
description = "MIEM employees parser, admin API, and web admin"
|
||||
requires-python = ">=3.11"
|
||||
dependencies = [
|
||||
|
||||
@@ -77,6 +77,23 @@ def main():
|
||||
columns = page.get_by_role("button", name="Настроить колонки")
|
||||
panel = page.locator(".directory__filter-panel")
|
||||
|
||||
dpo = page.get_by_role("columnheader", name="ДПО", exact=True)
|
||||
taught = page.get_by_role("columnheader", name="Преподаваемые курсы")
|
||||
expect(dpo).to_be_visible()
|
||||
page.evaluate("""localStorage.setItem("miem.directory.columns", JSON.stringify(
|
||||
["full_name", "status", "positions", "courses_count", "last_seen_at", "profile"]))""")
|
||||
page.reload()
|
||||
expect(dpo).to_be_visible()
|
||||
expect(taught).to_have_count(0)
|
||||
headers = page.get_by_role("columnheader").all_text_contents()
|
||||
assert headers == ["ФИО", "Статус", "Должности", "ДПО", "Последний раз найден", "Профиль"]
|
||||
columns.click()
|
||||
page.get_by_label("Преподаваемые курсы", exact=True).check()
|
||||
page.get_by_label("ДПО", exact=True).uncheck()
|
||||
page.reload()
|
||||
expect(taught).to_be_visible()
|
||||
expect(dpo).to_have_count(0)
|
||||
|
||||
# Immediate filter feedback, actual disabled controls, inert links.
|
||||
pps.check()
|
||||
expect(overlay).to_be_visible()
|
||||
@@ -168,11 +185,13 @@ def main():
|
||||
full_name=f"Сотрудник {i}") for i in range(3, 27))
|
||||
db.commit()
|
||||
page.goto("http://miem.test/admin/directory?limit=25")
|
||||
page.route("**/*offset=25*", lambda route: pending.append(route))
|
||||
page.get_by_role("link", name="Вперед").click(no_wait_after=True)
|
||||
expect(page.locator("[data-page-status]")).to_be_visible()
|
||||
expect(overlay).to_be_visible()
|
||||
fulfill(pending.pop())
|
||||
# Observe the outgoing page before Chromium starts the navigation.
|
||||
visible = page.get_by_role("link", name="Вперед").evaluate("""link => {
|
||||
link.click();
|
||||
return ["[data-page-status]", "[data-directory-loading]"].map(selector =>
|
||||
document.querySelector(selector).getClientRects().length > 0);
|
||||
}""")
|
||||
assert visible == [True, True]
|
||||
expect(summary).to_have_text("Показаны 26–26 из 26")
|
||||
expect(overlay).to_be_hidden()
|
||||
assert not errors, errors
|
||||
|
||||
+12
-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.4"
|
||||
|
||||
|
||||
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:]] == [
|
||||
|
||||
@@ -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.4 · Frontend 2.4.4" 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
|
||||
|
||||
+21
-7
@@ -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,19 +455,33 @@ 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"]
|
||||
assert [row["dpo_count"] for row in result] == [1]
|
||||
sheet = load_workbook(BytesIO(directory_xlsx(result))).active
|
||||
assert sheet.cell(2, sheet.max_column).value == 1
|
||||
dpo_column = next(cell.column for cell in sheet[1] if cell.value == "ДПО")
|
||||
assert sheet.cell(2, dpo_column).value == 1
|
||||
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