feat: update capability levels and enhance exercise filtering
Deploy Development / deploy (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 5s
Test Suite / playwright-tests (push) Failing after 1m55s

- Updated capability level mappings in the backend to reflect new terminology (e.g., "einsteiger" to "basis" and "experte" to "optimierung").
- Refactored the exercise management logic to normalize skill levels using canonical slugs, improving consistency across the application.
- Enhanced the ExercisesListPage with additional filtering options for style direction, training type, and target group, along with AI search capabilities.
- Incremented application version to 0.7.7 and updated changelog to document these changes.
This commit is contained in:
Lars committed 2026-04-27 18:25:23 +02:00
1 parent c6d20e4dec
commit 76098f5244
8 files changed
+418 -56

No files matched your search

+14 -16
View File
@@ -21,11 +21,11 @@ logger = logging.getLogger(__name__)
# Mapping: SMW-Integer → Shinkan-Stufenname
CAPABILITY_LEVEL_MAP = {
"1": "einsteiger",
"1": "basis",
"2": "grundlagen",
"3": "aufbau",
"4": "fortgeschritten",
"5": "experte",
"5": "optimierung",
}
@@ -167,8 +167,8 @@ def parse_equipment(raw: list[str]) -> list[str]:
def map_capability_level(level_str: str) -> str:
"""Wandelt Integer-Level in benannte Stufe: "3" → "aufbau" """
return CAPABILITY_LEVEL_MAP.get(level_str.strip(), "einsteiger")
"""Wandelt Integer-Level in kanonischen Stufen-Slug: "3" → "aufbau" """
return CAPABILITY_LEVEL_MAP.get(level_str.strip(), "basis")
# ------------------------------------------------------------------ #
@@ -273,9 +273,7 @@ def build_skill_assignments(mapped: dict) -> list[dict]:
Erstellt Skill-Zuordnungen aus PrimaryCapability + CapabilityLevel.
CapabilityLevel [3, 2] korrespondiert mit PrimaryCapability [Schnellkraft, Schnelligkeitsausdauer]
→ ergibt: [{skill: Schnellkraft, target_level: 3}, {skill: Schnelligkeitsausdauer, target_level: 2}]
WICHTIG: target_level ist INTEGER (1-5), nicht String!
→ target_level als kanonischer Slug (basis … optimierung), DB VARCHAR.
"""
skills = mapped.get("skill_names", [])
levels = mapped.get("skill_levels_raw", [])
@@ -283,18 +281,18 @@ def build_skill_assignments(mapped: dict) -> list[dict]:
assignments = []
for idx, skill_name in enumerate(skills):
level_str = levels[idx] if idx < len(levels) else "1"
# Konvertiere zu INTEGER statt String-Namen
try:
target_level = int(level_str.strip())
except (ValueError, AttributeError):
target_level = 1 # Fallback
raw = str(level_str).strip()
except (TypeError, AttributeError):
raw = "1"
target_slug = map_capability_level(raw) if raw else "basis"
assignments.append({
"skill_name": skill_name,
"target_level": target_level, # INTEGER 1-5
"required_level": None, # Nicht im Wiki spezifiziert
"intensity": None, # Nicht im Wiki spezifiziert
"is_primary": idx == 0,
"skill_name": skill_name,
"target_level": target_slug,
"required_level": None,
"intensity": None,
"is_primary": idx == 0,
})
return assignments