All checks were successful
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 44s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m13s
- Added new functions for computing assignment quality scores and counting step assignment statistics, improving the evaluation of steps in path quality assessments. - Updated existing methods to incorporate the new scoring logic, enhancing the robustness of path evaluations. - Introduced UI components in the frontend to display detailed quality assessment results, including handling of split dimensions in path evaluations. - Enhanced tests to cover new functionalities and ensure accuracy in quality scoring and slot management processes.
63 lines
2.0 KiB
Python
63 lines
2.0 KiB
Python
"""Getrennte Roadmap- vs. Besetzungs-QS."""
|
|
from planning_exercise_path_qa import (
|
|
build_assignment_qa_snapshot,
|
|
build_path_qa_summary,
|
|
compute_assignment_quality_score,
|
|
merge_path_quality_scores,
|
|
)
|
|
|
|
|
|
def _empty_steps(n: int):
|
|
return [{"roadmap_major_step_index": i, "exercise_id": None} for i in range(n)]
|
|
|
|
|
|
def test_assignment_quality_all_empty_slots_is_low():
|
|
steps = _empty_steps(5)
|
|
score = compute_assignment_quality_score(steps=steps, off_topic_steps=[], gaps=[])
|
|
assert score <= 0.15
|
|
|
|
|
|
def test_assignment_quality_all_filled_is_high():
|
|
steps = [{"roadmap_major_step_index": i, "exercise_id": i + 1} for i in range(5)]
|
|
score = compute_assignment_quality_score(steps=steps, off_topic_steps=[], gaps=[])
|
|
assert score >= 0.9
|
|
|
|
|
|
def test_build_path_qa_summary_caps_llm_score_when_slots_empty():
|
|
steps = _empty_steps(4)
|
|
summary = build_path_qa_summary(
|
|
gaps=[],
|
|
bridge_inserts=[],
|
|
ai_proposals=[],
|
|
off_topic_steps=[],
|
|
stripped_off_topic=[],
|
|
llm_qa={
|
|
"overall_ok": True,
|
|
"quality_score": 0.88,
|
|
"topic_coverage": "Roadmap deckt Ziel gut ab",
|
|
"issues": [],
|
|
"recommendations": ["Feinschliff Stufe 3"],
|
|
},
|
|
llm_applied=True,
|
|
steps=steps,
|
|
)
|
|
assert summary["roadmap_qa"]["quality_score"] == 0.88
|
|
assert summary["assignment_qa"]["empty_slot_count"] == 4
|
|
assert summary["assignment_qa"]["quality_score"] <= 0.15
|
|
assert summary["quality_score"] <= 0.15
|
|
assert summary["overall_ok"] is False
|
|
|
|
|
|
def test_merge_path_quality_uses_minimum():
|
|
assert merge_path_quality_scores(
|
|
{"quality_score": 0.88},
|
|
{"quality_score": 0.12},
|
|
) == 0.12
|
|
|
|
|
|
def test_assignment_snapshot_reports_empty_slots():
|
|
snap = build_assignment_qa_snapshot(steps=_empty_steps(3), off_topic_steps=[], gaps=[])
|
|
assert snap["empty_slot_count"] == 3
|
|
assert snap["overall_ok"] is False
|
|
assert any("ohne Übung" in issue for issue in snap["issues"])
|