Implement Phase 3 Enhancements for Skill Scoring and Profiles
Deploy Development / deploy (push) Failing after 22s
Test Suite / pytest-backend (push) Successful in 35s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Failing after 3s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m14s
Deploy Development / deploy (push) Failing after 22s
Test Suite / pytest-backend (push) Successful in 35s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Failing after 3s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m14s
- Added capabilities for weighted skill profiles, allowing trainers to compare training modules, frameworks, and regression paths based on skill contributions. - Updated the skill scoring specification to include peer context separation and list filtering, ensuring accurate comparisons among visible artifacts of the same type. - Enhanced the API to support batch summaries for skill profiles and discovery suggestions, improving data retrieval efficiency. - Refactored frontend components to display skill metrics, including scores and peer percentages, with improved filtering options for better user experience. - Updated documentation to reflect the latest changes and enhancements in the skill scoring system.
This commit is contained in:
1 parent
a7a428745f
commit
1d698e4b0a
17 files changed
+296
-88
No files matched your search
@@ -113,6 +113,25 @@ def normalize_exercise_skill_level(value) -> Optional[str]:
|
||||
return s
|
||||
return _LEGACY_SKILL_LEVEL_SLUG.get(s)
|
||||
|
||||
|
||||
_ALLOWED_SKILL_INTENSITY = frozenset({"niedrig", "mittel", "hoch"})
|
||||
|
||||
|
||||
def normalize_exercise_skill_intensity(value) -> str:
|
||||
"""Kanonische Nutzeneinschätzung; leer/ungültig → mittel (kein leerer Wert)."""
|
||||
if value is None:
|
||||
return "mittel"
|
||||
key = str(value).strip().lower()
|
||||
if key in ("low",):
|
||||
return "niedrig"
|
||||
if key in ("medium",):
|
||||
return "mittel"
|
||||
if key in ("high",):
|
||||
return "hoch"
|
||||
if key in _ALLOWED_SKILL_INTENSITY:
|
||||
return key
|
||||
return "mittel"
|
||||
|
||||
MEDIA_ROOT = Path(os.getenv("MEDIA_ROOT", str(Path(__file__).resolve().parent.parent / "media")))
|
||||
MAX_EXERCISE_MEDIA = 10
|
||||
# Upload-Limits (Übungs-Medien): Trainer wie bisher kleiner; Admin/Superadmin höheres Limit für große Videos
|
||||
@@ -1102,13 +1121,15 @@ def enrich_exercise_detail(exercise_id: int, cur) -> dict:
|
||||
FROM exercise_skills es
|
||||
JOIN skills s ON es.skill_id = s.id
|
||||
WHERE es.exercise_id = %s
|
||||
ORDER BY es.is_primary DESC, s.name""",
|
||||
ORDER BY s.name""",
|
||||
(exercise_id,)
|
||||
)
|
||||
exercise["skills"] = [r2d(r) for r in cur.fetchall()]
|
||||
for sk in exercise["skills"]:
|
||||
sk["required_level"] = normalize_exercise_skill_level(sk.get("required_level"))
|
||||
sk["target_level"] = normalize_exercise_skill_level(sk.get("target_level"))
|
||||
sk["intensity"] = normalize_exercise_skill_intensity(sk.get("intensity"))
|
||||
sk["is_primary"] = False
|
||||
|
||||
# Variants (1:N) - mit Progression (Reihenfolge: sequence_order, dann progression_level)
|
||||
cur.execute(
|
||||
@@ -1223,8 +1244,8 @@ def assign_exercise_relations(
|
||||
(
|
||||
exercise_id,
|
||||
skill["skill_id"],
|
||||
skill.get("is_primary", False),
|
||||
skill.get("intensity"),
|
||||
False,
|
||||
normalize_exercise_skill_intensity(skill.get("intensity")),
|
||||
normalize_exercise_skill_level(skill.get("required_level")),
|
||||
normalize_exercise_skill_level(skill.get("target_level")),
|
||||
skill.get("ai_suggested", False),
|
||||
|
||||
@@ -18,6 +18,7 @@ from db import get_db, get_cursor, r2d
|
||||
from auth import require_auth
|
||||
from smw_client import SmwClient, SmwClientError
|
||||
from smw_mapper import map_wiki_to_exercise, map_wiki_to_skill, map_wiki_to_method, build_skill_assignments
|
||||
from routers.exercises import normalize_exercise_skill_intensity
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -615,14 +616,16 @@ def _assign_exercise_skills(cur, conn, exercise_id: int, skill_assignments: list
|
||||
VALUES (%s, %s, %s, %s, %s, %s)
|
||||
ON CONFLICT (exercise_id, skill_id) DO UPDATE SET
|
||||
target_level = EXCLUDED.target_level,
|
||||
is_primary = EXCLUDED.is_primary""",
|
||||
required_level = EXCLUDED.required_level,
|
||||
intensity = EXCLUDED.intensity,
|
||||
is_primary = false""",
|
||||
(
|
||||
exercise_id,
|
||||
sid,
|
||||
assignment.get("target_level"),
|
||||
assignment.get("required_level"),
|
||||
assignment.get("intensity"),
|
||||
assignment.get("is_primary", False),
|
||||
normalize_exercise_skill_intensity(assignment.get("intensity")),
|
||||
False,
|
||||
)
|
||||
)
|
||||
conn.commit()
|
||||
|
||||
@@ -377,8 +377,8 @@ def build_skill_assignments(mapped: dict) -> list[dict]:
|
||||
"skill_name": skill_name,
|
||||
"target_level": target_slug,
|
||||
"required_level": None,
|
||||
"intensity": None,
|
||||
"is_primary": idx == 0,
|
||||
"intensity": "mittel",
|
||||
"is_primary": False,
|
||||
})
|
||||
return assignments
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
"""Normalisierung Übung ↔ Fähigkeit Intensität."""
|
||||
from routers.exercises import normalize_exercise_skill_intensity
|
||||
|
||||
|
||||
def test_normalize_exercise_skill_intensity_defaults_to_mittel():
|
||||
assert normalize_exercise_skill_intensity(None) == "mittel"
|
||||
assert normalize_exercise_skill_intensity("") == "mittel"
|
||||
assert normalize_exercise_skill_intensity("—") == "mittel"
|
||||
|
||||
|
||||
def test_normalize_exercise_skill_intensity_canonical():
|
||||
assert normalize_exercise_skill_intensity("niedrig") == "niedrig"
|
||||
assert normalize_exercise_skill_intensity("mittel") == "mittel"
|
||||
assert normalize_exercise_skill_intensity("hoch") == "hoch"
|
||||
|
||||
|
||||
def test_normalize_exercise_skill_intensity_legacy_aliases():
|
||||
assert normalize_exercise_skill_intensity("low") == "niedrig"
|
||||
assert normalize_exercise_skill_intensity("medium") == "mittel"
|
||||
assert normalize_exercise_skill_intensity("high") == "hoch"
|
||||
Reference in new issue
Block a user