forked from admin/miem_workers
fix: preserve categorized quartile evidence for council assessment
This commit is contained in:
1 parent
f4fb966b78
commit
c58bb8d626
8 files changed
+58
-21
No files matched your search
+1
-1
@@ -18,7 +18,7 @@ def test_health_returns_versions():
|
||||
response = TestClient(app).get("/api/health")
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.json()["backend_version"] == "1.0.0"
|
||||
assert response.json()["backend_version"] == "1.0.1"
|
||||
|
||||
|
||||
def test_api_employees_and_stats_require_admin_session():
|
||||
|
||||
@@ -219,7 +219,7 @@ def test_public_page_data_minimization_and_safe_links(db_session, export):
|
||||
assert "<script>" in response.text and "<script>" not in response.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 1.0.0 · Frontend 1.0.0" in response.text
|
||||
assert "Backend 1.0.1 · Frontend 1.0.1" 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
|
||||
|
||||
@@ -453,3 +453,29 @@ def test_branch_selection_threshold_and_export(db_session, proofs):
|
||||
assert parameters['Конец периода'] == datetime(2026, 12, 31)
|
||||
finally:
|
||||
app.dependency_overrides.clear()
|
||||
|
||||
|
||||
@pytest.mark.parametrize('category,metric,expected', [
|
||||
('Applied Mathematics', 'CiteScore', True),
|
||||
('Analysis', 'CiteScore', False),
|
||||
('Analysis', 'SJR', True),
|
||||
])
|
||||
def test_automatic_quartile_categories_and_metrics_preserve_conflicts(db_session, proofs, category, metric, expected):
|
||||
employee = person(db_session, ['Доктор технических наук'])
|
||||
first = {'system': 'Scopus', 'quartile': 'Q1', 'category': 'Analysis', 'metric': 'CiteScore',
|
||||
'metric_year': 2024, 'publication_year': 2024, 'doi': '10.1234/categories',
|
||||
'journal': 'Journal of Mathematics', 'source': 'Journal metrics 2024',
|
||||
'source_url': 'https://example.org/metrics', 'checked_on': '2026-10-08'}
|
||||
second = {**first, 'quartile': 'Q2', 'category': category, 'metric': metric}
|
||||
db_session.add(EmployeePublication(employee_id=employee.id, title='Categorized article', year=2024,
|
||||
publication_type='ARTICLE', source_hash='categories', doi_url='https://doi.org/10.1234/categories',
|
||||
raw_data={'journal': first['journal']}, quartiles={'schema_version': 1, 'entries': [first, second]}))
|
||||
candidate = result(db_session)
|
||||
assert candidate['q1_count'] == candidate['q2_count'] == candidate['total_count'] == 1
|
||||
assert candidate['confirmed_count'] == int(expected)
|
||||
article = candidate['articles'][0]
|
||||
assert ('Подтверждённые основания источников расходятся' in article['confirmation_reasons']) == (not expected)
|
||||
assert [(basis.get('category'), basis.get('metric'), basis.get('metric_year'), basis['source'], basis['source_url'])
|
||||
for basis in article['automatic_quartile_bases']] == [
|
||||
('Analysis', 'CiteScore', 2024, first['source'], first['source_url']),
|
||||
(category, metric, 2024, second['source'], second['source_url'])]
|
||||
Reference in new issue
Block a user