feat: Update session metrics handling for CSV-mapped values
Deploy Development / deploy (push) Successful in 54s
Build Test / pytest-backend (push) Successful in 5s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 16s

- Enhanced the docstring for `upsert_session_metrics_from_csv_mapped` to clarify the handling of schema parameters and EAV logic.
- Modified the condition for skipping updates based on `source_field` to ensure only patchable columns are processed, improving data integrity during session metrics upsert operations.
This commit is contained in:
Lars committed 2026-04-15 10:28:13 +02:00
1 parent e4e8c70cd2
commit 9d47c4ef84
2 files changed
+47 -2

No files matched your search

+12 -2
View File
@@ -313,7 +313,17 @@ def upsert_session_metrics_from_csv_mapped(
training_category: Optional[str],
training_type_id: Optional[int],
) -> None:
"""EAV nur für Schema-Parameter ohne source_field (reine Session-Metriken)."""
"""
EAV für Schema-Parameter aus CSV-mapped Werten.
Spalten-gestützte Parameter (source_field ∈ ACTIVITY_LOG_PATCHABLE_COLUMNS) werden
ausschließlich über resolve_activity_log_column_patch_from_csv → activity_log
geschrieben — hier kein EAV.
Wenn source_field gesetzt ist, aber **kein** patchbarer Spaltenname (z. B. eigener
Key „stola“ wie der Parametername), wäre früher weder Spalten-Update noch EAV erfolgt;
dann EAV wie bei reinen Metriken.
"""
cur.execute(
"SELECT profile_id FROM activity_log WHERE id = %s",
(activity_log_id,),
@@ -330,7 +340,7 @@ def upsert_session_metrics_from_csv_mapped(
if raw is None or raw == "":
continue
src_col = (spec.get("source_field") or "").strip()
if src_col:
if src_col and src_col in ACTIVITY_LOG_PATCHABLE_COLUMNS:
continue
tid = spec["training_parameter_id"]
dt = spec["data_type"]