fix: Debugging für Brush-Datenbereich hinzugefügt

- `console.log`-Ausgaben für `vonDatum`, `bisDatum` und `formatierteDaten` hinzugefügt
- Fehleranalyse für `startIndex` und `endIndex` in `LoopMeasurementChart.tsx`
- Falls `startIndex` oder `endIndex` nicht gefunden wird, wird die gesamte Datenreihe geloggt
- Vorbereitung für Fallback-Lösung, falls Datum nicht exakt gefunden wird
This commit is contained in:
ISA
2025-03-14 12:07:51 +01:00
parent 0139ef656b
commit 029ed843d8
3 changed files with 26 additions and 17 deletions

View File

@@ -126,14 +126,28 @@ const LoopMeasurementChart = () => {
},
[dispatch, formatierteDaten]
);
//--------------------------------------------------------------------------------
useEffect(() => {
if (formatierteDaten.length) {
console.log("🔍 Redux vonDatum:", vonDatum);
console.log("🔍 Redux bisDatum:", bisDatum);
//console.log("🔍 Verfügbare Zeitpunkte in formatierteDaten:");
/* formatierteDaten.forEach((d, index) => {
console.log(
`${index}: ${new Date(d.zeit).toISOString().split("T")[0]}`
);
});
*/
const startIndex = formatierteDaten.findIndex(
(d) => new Date(d.zeit).toISOString().split("T")[0] === vonDatum
);
//console.log("startIndex in Brush ", startIndex);
const endIndex = formatierteDaten.findIndex(
(d) => new Date(d.zeit).toISOString().split("T")[0] === bisDatum
);
//console.log("endIndex in Brush ", endIndex);
if (startIndex !== -1 && endIndex !== -1) {
dispatch(
@@ -147,6 +161,7 @@ const LoopMeasurementChart = () => {
}
}
}, [vonDatum, bisDatum, formatierteDaten, dispatch]);
//----------------------------------------------------------------
return (
<div style={{ width: "100%", height: isFullScreen ? "90%" : "400px" }}>