feat: update version to 0.7.5 and enhance maturity model binding logic
- Incremented application version to 0.7.5 and updated maturity model version to 1.3.1. - Improved binding logic to ensure that only relevant entries are considered based on the presence of context bindings. - Updated documentation to clarify the behavior of binding resolution and its impact on legacy model resolution. - Documented changes in the changelog for version 0.7.5, detailing the new binding resolution rules.
This commit is contained in:
1 parent
f2c007cc68
commit
863535aa26
3 files changed
+54
-9
No files matched your search
@@ -260,7 +260,18 @@ def _binding_matches_query_dims(
|
||||
b_style: Any,
|
||||
b_tt: Any,
|
||||
) -> bool:
|
||||
"""Zeile passt zur Abfrage, wenn gesetzte Dimensionswerte der Zeile mit der Anfrage übereinstimmen."""
|
||||
"""
|
||||
Prüft, ob eine Binding-Zeile zur Anfrage passt.
|
||||
|
||||
Nicht gesetzte Spalten der Zeile gelten als „egal“ (Wildcard):
|
||||
- Nur Fokus: Stilrichtung und Trainingsstil NULL → gilt für alle Stile/Trainingsstile unter diesem Fokus.
|
||||
- Fokus + Stilrichtung: Trainingsstil NULL → gilt nur für diese Stilrichtung, für jeden Trainingsstil.
|
||||
- Fokus + Trainingsstil: Stilrichtung NULL → gilt nur für diesen Trainingsstil, für jede Stilrichtung.
|
||||
- Alle drei gesetzt → ausschließlich diese Kombination.
|
||||
|
||||
In der Anfrage fehlende Dimensionen schließen Zeilen aus, die diese Dimension festgelegt haben
|
||||
(z. B. Fokus+Trainingsstil-Binding zählt nicht, wenn kein Trainingsstil angefragt wird).
|
||||
"""
|
||||
if b_style is not None:
|
||||
if style_direction_id is None or int(b_style) != int(style_direction_id):
|
||||
return False
|
||||
@@ -279,6 +290,18 @@ def _binding_dim_count(b_style: Any, b_tt: Any) -> int:
|
||||
return n
|
||||
|
||||
|
||||
def _focus_has_any_bindings(cur, focus_area_id: int) -> bool:
|
||||
cur.execute(
|
||||
"""
|
||||
SELECT 1 FROM maturity_model_context_bindings
|
||||
WHERE focus_area_id = %s
|
||||
LIMIT 1
|
||||
""",
|
||||
(focus_area_id,),
|
||||
)
|
||||
return cur.fetchone() is not None
|
||||
|
||||
|
||||
def _resolve_binding_model_ids(
|
||||
cur,
|
||||
focus_area_id: int,
|
||||
@@ -449,6 +472,8 @@ def resolve_maturity_model(
|
||||
Zuordnungen überschreiben Zelltexte gleicher Fähigkeit/Stufe.
|
||||
|
||||
**Priorität 2 (Legacy):** Ein aktives Modell per M:N am Modell (Zielgruppe unverändert).
|
||||
Nur wenn für den Fokusbereich **keine** Einträge in `maturity_model_context_bindings` existieren —
|
||||
sonst würde Legacy den Trainingsstil ignorieren und Kontext-Bindings unterlaufen.
|
||||
"""
|
||||
with get_db() as conn:
|
||||
cur = get_cursor(conn)
|
||||
@@ -462,6 +487,8 @@ def resolve_maturity_model(
|
||||
if chain:
|
||||
loaded = [_load_full_model(cur, mid) for mid in chain]
|
||||
return _merge_loaded_models(loaded)
|
||||
if _focus_has_any_bindings(cur, int(focus_area_id)):
|
||||
return None
|
||||
|
||||
mid = _legacy_resolve_pick_model_id(
|
||||
cur, focus_area_id, style_direction_id, target_group_id
|
||||
@@ -1188,13 +1215,19 @@ def export_resolved_maturity_bundle(
|
||||
loaded = [_load_full_model(cur, mid) for mid in chain]
|
||||
merged = _merge_loaded_models(loaded)
|
||||
else:
|
||||
if _focus_has_any_bindings(cur, int(focus_area_id)):
|
||||
raise HTTPException(
|
||||
404,
|
||||
"Kein Reifegradmodell für diese Kontext-Kombination (es gibt Bindings für diesen Fokus, "
|
||||
"aber keine passende Zeile).",
|
||||
)
|
||||
mid = _legacy_resolve_pick_model_id(
|
||||
cur, focus_area_id, style_direction_id, None
|
||||
)
|
||||
if mid is None:
|
||||
raise HTTPException(
|
||||
404,
|
||||
"Kein Modell für diesen Kontext (keine Bindings und kein Legacy-Treffer)",
|
||||
"Kein Modell für diesen Kontext (keine Bindings für den Fokus und kein Legacy-Treffer).",
|
||||
)
|
||||
merged = _load_full_model(cur, mid)
|
||||
|
||||
|
||||
Reference in new issue
Block a user