Enhance section movement validation in TrainingUnitSectionsEditor
All checks were successful
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 37s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 12s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m8s

- Added a new check to prevent section movement across slots that crosses the boundary between 'parallel' and 'whole_group' phases, improving the logic for section management and ensuring valid operations during edits.
This commit is contained in:
Lars 2026-05-16 08:09:24 +02:00
parent f1c470a8a3
commit 0fdee610ed

View File

@ -928,9 +928,23 @@ export default function TrainingUnitSectionsEditor({
}
}
let crossesParallelWholePlanBoundary = false
if (
enableParallelPhaseControls &&
(insertBeforeIdx === fromSi || insertBeforeIdx === fromSi + 1)
insertBeforeIdx >= 0 &&
insertBeforeIdx < list.length
) {
const fromK = list[fromSi]?.planLoc?.phaseKind
const toK = list[insertBeforeIdx]?.planLoc?.phaseKind
crossesParallelWholePlanBoundary =
(fromK === 'parallel' && toK === 'whole_group') ||
(fromK === 'whole_group' && toK === 'parallel')
}
if (
enableParallelPhaseControls &&
(insertBeforeIdx === fromSi || insertBeforeIdx === fromSi + 1) &&
!crossesParallelWholePlanBoundary
) {
return
}