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
.getElementById("timeRangeFilter")
.addEventListener("change", function () {
function attachTimeRangeListener() {
const timeRangeFilter = document.getElementById("timeRangeFilter");
if (timeRangeFilter) {
timeRangeFilter.addEventListener("change", function () {
// Save selection to localStorage
localStorage.setItem("lastSleepTimeRange", this.value);
loadData();
renderCharts();
});
}
}
async function loadData() {
try {
@@ -443,6 +446,9 @@
attachChildFilterListener();
}
// Always attach time range listener after recreating the controls
attachTimeRangeListener();
renderCharts();
} catch (error) {
console.error("Error loading data:", error);