From 029ed843d81a29f2f06a5706d07e5e6747db7515 Mon Sep 17 00:00:00 2001 From: ISA Date: Fri, 14 Mar 2025 12:07:51 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20Debugging=20f=C3=BCr=20Brush-Datenbereic?= =?UTF-8?q?h=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - `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 --- .../kue705FO/Charts/DateRangePicker.tsx | 26 +++++++------------ .../LoopMeasurementChart.tsx | 15 +++++++++++ config/webVersion.ts | 2 +- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/components/main/kabelueberwachung/kue705FO/Charts/DateRangePicker.tsx b/components/main/kabelueberwachung/kue705FO/Charts/DateRangePicker.tsx index ef878ce..a48cff0 100644 --- a/components/main/kabelueberwachung/kue705FO/Charts/DateRangePicker.tsx +++ b/components/main/kabelueberwachung/kue705FO/Charts/DateRangePicker.tsx @@ -1,22 +1,16 @@ -// /components/modules/kue705FO/charts/DateRangePicker.tsx -// /components/modules/kue705FO/charts/DateRangePicker.tsx import React from "react"; import DatePicker from "react-datepicker"; -import { useSelector } from "react-redux"; +import { useSelector, useDispatch } from "react-redux"; import { RootState } from "../../../../../redux/store"; -import "react-datepicker/dist/react-datepicker.css"; - -// ✅ Props-Definition für die Komponente hinzugefügt -interface DateRangePickerProps { - setVonDatum: (date: Date) => void; - setBisDatum: (date: Date) => void; -} - -const DateRangePicker: React.FC = ({ +import { setVonDatum, setBisDatum, -}) => { - // Redux-Werte abrufen +} from "../../../../../redux/slices/kabelueberwachungChartSlice"; +import "react-datepicker/dist/react-datepicker.css"; + +const DateRangePicker: React.FC = () => { + const dispatch = useDispatch(); + const reduxVonDatum = useSelector( (state: RootState) => state.kabelueberwachungChart.vonDatum ); @@ -32,7 +26,7 @@ const DateRangePicker: React.FC = ({ selected={reduxVonDatum ? new Date(reduxVonDatum) : new Date()} onChange={(date) => { if (date) { - setVonDatum(date); + dispatch(setVonDatum(date.toISOString().split("T")[0])); } }} selectsStart @@ -49,7 +43,7 @@ const DateRangePicker: React.FC = ({ selected={reduxBisDatum ? new Date(reduxBisDatum) : new Date()} onChange={(date) => { if (date) { - setBisDatum(date); + dispatch(setBisDatum(date.toISOString().split("T")[0])); } }} selectsEnd diff --git a/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx b/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx index 30ec783..f24eb80 100644 --- a/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx +++ b/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopMeasurementChart.tsx @@ -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 (
diff --git a/config/webVersion.ts b/config/webVersion.ts index 84a139f..7e7fc6d 100644 --- a/config/webVersion.ts +++ b/config/webVersion.ts @@ -6,5 +6,5 @@ 2: Patch oder Hotfix (Bugfixes oder kleine Änderungen). */ -const webVersion = "1.6.121"; +const webVersion = "1.6.122"; export default webVersion;