Merge pull request 'fixed updating charts with selected time range' (#34) from fix-sleep-overview-not-updating into main
Build and Push Docker Image / build-and-push (push) Successful in 26s
Python Code Quality / python-code-quality (push) Successful in 9s
Python Test / python-test (push) Successful in 18s

Reviewed-on: #34
This commit was merged in pull request #34.
This commit is contained in:
2025-11-13 14:12:13 +01:00
+10 -4
View File
@@ -345,13 +345,16 @@
} }
} }
document function attachTimeRangeListener() {
.getElementById("timeRangeFilter") const timeRangeFilter = document.getElementById("timeRangeFilter");
.addEventListener("change", function () { if (timeRangeFilter) {
timeRangeFilter.addEventListener("change", function () {
// Save selection to localStorage // Save selection to localStorage
localStorage.setItem("lastSleepTimeRange", this.value); localStorage.setItem("lastSleepTimeRange", this.value);
loadData(); renderCharts();
}); });
}
}
async function loadData() { async function loadData() {
try { try {
@@ -443,6 +446,9 @@
attachChildFilterListener(); attachChildFilterListener();
} }
// Always attach time range listener after recreating the controls
attachTimeRangeListener();
renderCharts(); renderCharts();
} catch (error) { } catch (error) {
console.error("Error loading data:", error); console.error("Error loading data:", error);