feat: enhance session metrics handling in activity summaries
Deploy Development / deploy (push) Successful in 55s
Build Test / pytest-backend (push) Successful in 5s
Build Test / lint-backend (push) Successful in 1s
Build Test / build-frontend (push) Successful in 16s

- Integrated compact JSON payload generation for session metrics in `get_training_sessions_recent_weeks_data`.
- Updated the registration of activity session insights to reflect the new compact format for session metrics.
- Improved documentation to clarify the structure and semantics of the session metrics in the JSON output.
- Added normalization for prompt numbers to ensure consistent formatting in the metrics.
This commit is contained in:
Lars committed 2026-04-18 10:24:44 +02:00
1 parent 7226e04e9c
commit 6756dc60f3
5 files changed
+188 -15

No files matched your search

+4 -2
View File
@@ -48,6 +48,8 @@ from data_layer.health_metrics import (
get_vo2_max_data
)
from data_layer.prompt_output_compact import compact_json_payload_for_prompts
from placeholder_registry import build_ai_placeholder_caption, get_registry
# {{key|d}} — nur description anhängen; {{key|x}} — nur Erklärung (ai_caption / Registry)
@@ -1028,8 +1030,8 @@ def _safe_json(func_name: str, profile_id: str) -> str:
# If already string, return it; otherwise convert to JSON
if isinstance(result, str):
return result
else:
return json.dumps(result, ensure_ascii=False, default=str)
compacted = compact_json_payload_for_prompts(result)
return json.dumps(compacted, ensure_ascii=False, default=str)
except Exception as e:
print(f"[ERROR] _safe_json({func_name}, {profile_id}): {type(e).__name__}: {e}")
traceback.print_exc()