feat: update history_overview_viz configuration and validation
- Replaced the `show_area_summaries` option with individual section visibility settings (`show_section_body`, `show_section_nutrition`, `show_section_fitness`, `show_section_recovery`) in the `history_overview_viz` widget configuration. - Implemented migration logic to handle legacy `show_area_summaries` settings, ensuring backward compatibility. - Updated validation logic to enforce visibility requirements for the new section keys. - Enhanced tests to cover new configuration scenarios and validate the migration logic. - Bumped application version to reflect these changes.
This commit is contained in:
1 parent
97dbb0f80b
commit
725e7ffe4b
7 files changed
+121
-25
No files matched your search
@@ -157,7 +157,10 @@ def test_history_overview_viz_empty_expands_defaults():
|
||||
d = validate_widget_entry_config("history_overview_viz", {})
|
||||
assert d["chart_days"] == 30
|
||||
assert d["show_confidence_banner"] is True
|
||||
assert d["show_area_summaries"] is True
|
||||
assert d["show_section_body"] is True
|
||||
assert d["show_section_nutrition"] is True
|
||||
assert d["show_section_fitness"] is True
|
||||
assert d["show_section_recovery"] is True
|
||||
assert d["show_correlation_c1_c3"] is True
|
||||
assert d["show_drivers_c4"] is True
|
||||
|
||||
@@ -176,13 +179,26 @@ def test_history_overview_viz_requires_visible_block():
|
||||
"history_overview_viz",
|
||||
{
|
||||
"show_confidence_banner": False,
|
||||
"show_area_summaries": False,
|
||||
"show_section_body": False,
|
||||
"show_section_nutrition": False,
|
||||
"show_section_fitness": False,
|
||||
"show_section_recovery": False,
|
||||
"show_correlation_c1_c3": False,
|
||||
"show_drivers_c4": False,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def test_history_overview_viz_legacy_show_area_summaries_maps_sections():
|
||||
d = validate_widget_entry_config(
|
||||
"history_overview_viz",
|
||||
{"show_area_summaries": False, "show_correlation_c1_c3": True},
|
||||
)
|
||||
assert d["show_section_body"] is False
|
||||
assert d["show_section_fitness"] is False
|
||||
assert d["show_correlation_c1_c3"] is True
|
||||
|
||||
|
||||
def test_history_overview_viz_unknown_key():
|
||||
with pytest.raises(ValueError):
|
||||
validate_widget_entry_config("history_overview_viz", {"evil": True})
|
||||
|
||||
Reference in new issue
Block a user