feat: Introduce quick capture widget configuration and validation
Deploy Development / deploy (push) Successful in 55s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 16s

- Added support for the "quick_capture" widget, allowing users to configure visibility for weight and baseline vitals (resting HR, HRV, VO₂max).
- Implemented validation logic to ensure correct configuration input and prevent errors.
- Updated the widget catalog and dashboard layout to reflect the new quick capture features.
- Removed the "training_type_distribution" widget from the catalog as part of the refactor.
- Bumped app_dashboard version to 1.6.2 to incorporate these enhancements.
This commit is contained in:
Lars committed 2026-04-07 18:02:18 +02:00
1 parent 3d498d03c1
commit 7f833b2cb1
9 files changed
+267 -107

No files matched your search

+26 -11
View File
@@ -45,6 +45,32 @@ def test_kpi_board_tiles():
validate_widget_entry_config("kpi_board", {"extra": 1})
def test_quick_capture_visibility():
assert validate_widget_entry_config("quick_capture", {}) == {}
assert validate_widget_entry_config("quick_capture", {"show_weight": False}) == {"show_weight": False}
full = {
"show_weight": True,
"show_resting_hr": False,
"show_hrv": True,
"show_vo2_max": False,
}
assert validate_widget_entry_config("quick_capture", full) == full
with pytest.raises(ValueError):
validate_widget_entry_config("quick_capture", {"show_weight": "yes"})
with pytest.raises(ValueError):
validate_widget_entry_config(
"quick_capture",
{
"show_weight": False,
"show_resting_hr": False,
"show_hrv": False,
"show_vo2_max": False,
},
)
with pytest.raises(ValueError):
validate_widget_entry_config("quick_capture", {"extra": 1})
def test_trend_kcal_weight_chart_days():
assert validate_widget_entry_config("trend_kcal_weight", {}) == {}
assert validate_widget_entry_config("trend_kcal_weight", {"chart_days": 30}) == {"chart_days": 30}
@@ -52,17 +78,6 @@ def test_trend_kcal_weight_chart_days():
validate_widget_entry_config("trend_kcal_weight", {"chart_days": 6})
def test_training_type_distribution_days():
assert validate_widget_entry_config("training_type_distribution", {}) == {}
assert validate_widget_entry_config(
"training_type_distribution", {"distribution_days": 28}
) == {"distribution_days": 28}
with pytest.raises(ValueError):
validate_widget_entry_config("training_type_distribution", {"distribution_days": 5})
with pytest.raises(ValueError):
validate_widget_entry_config("training_type_distribution", {"distribution_days": 200})
def test_kpi_board_legacy_chart_days_dropped():
"""Nur chart_days (Alt-Layouts) → automatische Kachelwahl, kein Ø-Kal-Fenster mehr."""
assert validate_widget_entry_config("kpi_board", {"chart_days": 14}) == {}