From 0fdee610ed5c189337ec193f97b5cd2906bdbfcf Mon Sep 17 00:00:00 2001 From: Lars Date: Sat, 16 May 2026 08:09:24 +0200 Subject: [PATCH] Enhance section movement validation in TrainingUnitSectionsEditor - 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. --- .../components/TrainingUnitSectionsEditor.jsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/TrainingUnitSectionsEditor.jsx b/frontend/src/components/TrainingUnitSectionsEditor.jsx index e7fa968..99b4807 100644 --- a/frontend/src/components/TrainingUnitSectionsEditor.jsx +++ b/frontend/src/components/TrainingUnitSectionsEditor.jsx @@ -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 }