fix(web): handle dotted keys in schema/config path helpers (#260)

* fix(web): handle dotted keys in schema/config path helpers

Schema property names containing dots (e.g. "eng.1" for Premier League
in soccer-scoreboard) were being incorrectly split on the dot separator
in two path-navigation helpers:

- _get_schema_property: split "leagues.eng.1.favorite_teams" into 4
  segments and looked for "eng" in leagues.properties, which doesn't
  exist (the key is literally "eng.1"). Returned None, so the field
  type was unknown and values were not parsed correctly.

- _set_nested_value: split the same path into 4 segments and created
  config["leagues"]["eng"]["1"]["favorite_teams"] instead of the
  correct config["leagues"]["eng.1"]["favorite_teams"].

Both functions now use a greedy longest-match approach: at each level
they try progressively longer dot-joined candidates first (e.g. "eng.1"
before "eng"), so dotted property names are handled transparently.

Fixes favorite_teams (and other per-league fields) not saving via the
soccer-scoreboard plugin config UI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: remove debug artifacts from merged branches

- Replace print() with logger.warning() for three error handlers in api_v3.py
  that bypassed the structured logging infrastructure
- Simplify dead if/else in loadInstalledPlugins() — both branches did the
  same window.installedPlugins assignment; collapse to single line
- Remove console.log registration line from schedule-picker widget that
  fired unconditionally on every page load

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Chuck <chuck@example.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Chuck
2026-02-23 17:21:19 -05:00
committed by GitHub
parent c2763d6447
commit 14b6a0c6a3
3 changed files with 64 additions and 42 deletions

View File

@@ -567,5 +567,4 @@
window.LEDMatrixWidgets.get('schedule-picker').getDefaultSchedule = getDefaultSchedule;
window.LEDMatrixWidgets.get('schedule-picker').normalizeSchedule = normalizeSchedule;
console.log('[SchedulePickerWidget] Schedule picker widget registered');
})();

View File

@@ -1330,17 +1330,7 @@ function loadInstalledPlugins(forceRefresh = false) {
pluginLoadCache.timestamp = Date.now();
// Always update window.installedPlugins to ensure Alpine component can detect changes
const currentPlugins = Array.isArray(window.installedPlugins) ? window.installedPlugins : [];
const currentIds = currentPlugins.map(p => p.id).sort().join(',');
const newIds = installedPlugins.map(p => p.id).sort().join(',');
const pluginsChanged = currentIds !== newIds;
if (pluginsChanged) {
window.installedPlugins = installedPlugins;
} else {
// Even if IDs haven't changed, update the array reference to trigger Alpine reactivity
window.installedPlugins = installedPlugins;
}
window.installedPlugins = installedPlugins;
// Dispatch event to notify Alpine component to update tabs
document.dispatchEvent(new CustomEvent('pluginsUpdated', {