feat: add recovery_history_viz widget and enhance configuration handling
Deploy Development / deploy (push) Successful in 47s
Build Test / pytest-backend (push) Successful in 4s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 15s

- Introduced the `recovery_history_viz` widget to the dashboard, enabling users to visualize recovery history data.
- Updated widget configuration to include `recovery_history_viz` in the allowed widgets and added validation for its configuration.
- Enhanced the widget catalog with details for the new `recovery_history_viz` entry.
- Implemented default values and validation logic for the widget's configuration, ensuring proper handling of user inputs.
- Added tests to ensure proper validation of the `recovery_history_viz` widget configuration.
- Bumped application version to reflect the addition of the new widget.
This commit is contained in:
Lars committed 2026-04-22 10:18:02 +02:00
1 parent d22e0ba0a7
commit e20b321b64
16 files changed
+735 -258

No files matched your search

@@ -113,6 +113,46 @@ def test_fitness_history_viz_unknown_key():
validate_widget_entry_config("fitness_history_viz", {"evil": True})
def test_recovery_history_viz_empty_expands_defaults():
d = validate_widget_entry_config("recovery_history_viz", {})
assert d["chart_days"] == 30
assert d["show_kpis"] is True
assert d["show_chart_recovery_score"] is True
assert d["kpi_detail"] == "compact"
assert d["show_heart_context_card"] is False
assert d["show_vitals_extra_trends"] is False
def test_recovery_history_viz_chart_days_and_merge():
d = validate_widget_entry_config("recovery_history_viz", {"chart_days": 42})
assert d["chart_days"] == 42
assert d["show_layer_meta"] is False
with pytest.raises(ValueError):
validate_widget_entry_config("recovery_history_viz", {"chart_days": 3})
def test_recovery_history_viz_requires_visible_block():
with pytest.raises(ValueError):
validate_widget_entry_config(
"recovery_history_viz",
{
"show_kpis": False,
"show_progress_insights": False,
"show_heart_context_card": False,
"show_vitals_extra_trends": False,
"show_chart_recovery_score": False,
"show_chart_sleep_quality": False,
"show_chart_sleep_debt": False,
"show_chart_hrv_rhr": False,
},
)
def test_recovery_history_viz_unknown_key():
with pytest.raises(ValueError):
validate_widget_entry_config("recovery_history_viz", {"evil": True})
def test_welcome_config_rejected_unknown_key():
with pytest.raises(ValueError):
validate_widget_entry_config("welcome", {"x": 1})
@@ -33,7 +33,7 @@ def test_get_product_default_base_uses_db_when_valid(monkeypatch):
"widgets": [{"id": wid, "enabled": wid == "welcome"} for wid in sorted(ALLOWED_WIDGET_IDS)],
}
# Gleicher Pfad wie get_stored_product_default_validated: Widget-Configs werden normalisiert
# (z. B. body_history_viz / nutrition_history_viz / fitness_history_viz: leere config → volle Defaults in to_stored_dict).
# (z. B. body_history_viz / nutrition_history_viz / fitness_history_viz / recovery_history_viz: leere config → volle Defaults in to_stored_dict).
expected = DashboardLayoutPayload.model_validate(small).to_stored_dict()
class _Cur: