Enhance TrainingUnitSectionsEditor and TrainingFrameworkProgramEditPage with parallel stream support
Deploy Development / deploy (push) Successful in 41s
Test Suite / pytest-backend (push) Successful in 37s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 11s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m8s

- Updated the TrainingUnitSectionsEditor to include additional parameters for moving sections across slots, allowing for better handling of parallel streams.
- Improved the removeSection function to ensure proper reordering and handling of sections in parallel phases.
- Enhanced the moveSectionsAcrossFrameworkSlots function to apply changes to sections when moved into parallel streams, ensuring accurate updates.
- Refactored the reorderBlocksImmutableWithPlanLoc function to accommodate new logic for managing phase orders and section types during reordering.
This commit is contained in:
Lars committed 2026-05-15 10:21:15 +02:00
1 parent 4902771772
commit 73975d3402
3 files changed
+53 -15

No files matched your search

@@ -243,7 +243,7 @@ function reorderBlocksImmutable(blocks, fromI, toBeforeIdx) {
/**
* @param {(updater: (prev: Array) => Array) => void} props.onSectionsChange — wie React setState
* @param {(p: { fromSlot: number, fromSectionIdx: number, toSlot: number, toSectionIdx: number }) => void} [props.onMoveSectionsAcrossSlots] — Rahmenprogramm: Abschnitt zwischen Slots verschieben
* @param {(p: { fromSlot: number, fromSectionIdx: number, toSlot: number, toSectionIdx: number, toParallelStream?: { po: number, so: number } }) => void} [props.onMoveSectionsAcrossSlots] — Rahmenprogramm: Abschnitt zwischen Slots verschieben
*/
export default function TrainingUnitSectionsEditor({
sections,
@@ -463,8 +463,12 @@ export default function TrainingUnitSectionsEditor({
const removeSection = (sIdx) => {
patch((prev) => {
const next = prev.filter((_, i) => i !== sIdx)
return next.length ? next : [defaultSection()]
let next = prev.filter((_, i) => i !== sIdx)
next = next.length ? next : [defaultSection()]
if (enableParallelPhaseControls) {
next = afterSectionReorderParallelGuard(prev, next)
}
return next
})
}
@@ -843,6 +847,7 @@ export default function TrainingUnitSectionsEditor({
fromSectionIdx: fromSi,
toSlot: sectionToSlot,
toSectionIdx: toIdx,
toParallelStream: { po, so },
})
return
}
@@ -1177,6 +1182,12 @@ export default function TrainingUnitSectionsEditor({
parallelPhaseOrder != null
? firstSectionIndexByParallelPhase.get(parallelPhaseOrder)
: null
const phaseIndicesAll =
parallelPhaseOrder != null ? indicesOfParallelPhase(list, parallelPhaseOrder) : []
const isLastGlobalRowOfParallelPhase =
pl?.phaseKind === 'parallel' &&
phaseIndicesAll.length > 0 &&
sIdx === phaseIndicesAll[phaseIndicesAll.length - 1]
const firstVisibleIdxActiveStream =
parallelPhaseOrder != null && streamOrdersForParallelPhase.length
? sectionIndicesForParallelStream(
@@ -1193,7 +1204,9 @@ export default function TrainingUnitSectionsEditor({
sIdx !== firstGlobalIdxThisPhase
const showSectionDropBandBefore =
(pl?.phaseKind !== 'parallel' || !hideParallelSection) &&
(pl?.phaseKind !== 'parallel' ||
!hideParallelSection ||
isLastGlobalRowOfParallelPhase) &&
!hideDropBandBeforeOrphanFirstVisible
const bandActiveBefore = (bx) =>