fix: Timer für jeder KÜ separate und nicht eine für alle, aktuell wird prozentzahl bei allen das gleiche angezeigt

This commit is contained in:
ISA
2025-09-08 10:46:20 +02:00
parent 9c218b2a1d
commit 72341abb23
8 changed files with 44 additions and 32 deletions

View File

@@ -75,17 +75,24 @@ export const deviceEventsSlice = createSlice({
// Per-slot transition detection
for (let i = 0; i < 32; i++) {
if (prevKsx[i] === 0 && state.ksx[i] === 1) {
state.loopStartedAtBySlot[i] = Date.now();
// Only set if no existing (hydrated) timestamp
if (!state.loopStartedAtBySlot[i]) {
state.loopStartedAtBySlot[i] = Date.now();
}
} else if (prevKsx[i] === 1 && state.ksx[i] === 0) {
state.loopStartedAtBySlot[i] = null;
}
if (prevKsy[i] === 0 && state.ksy[i] === 1) {
state.tdrStartedAtBySlot[i] = Date.now();
if (!state.tdrStartedAtBySlot[i]) {
state.tdrStartedAtBySlot[i] = Date.now();
}
} else if (prevKsy[i] === 1 && state.ksy[i] === 0) {
state.tdrStartedAtBySlot[i] = null;
}
if (prevKsz[i] === 0 && state.ksz[i] === 1) {
state.comparisonStartedAtBySlot[i] = Date.now();
if (!state.comparisonStartedAtBySlot[i]) {
state.comparisonStartedAtBySlot[i] = Date.now();
}
} else if (prevKsz[i] === 1 && state.ksz[i] === 0) {
state.comparisonStartedAtBySlot[i] = null;
}