Improve section movement validation in TrainingUnitSectionsEditor
All checks were successful
Deploy Development / deploy (push) Successful in 41s
Test Suite / pytest-backend (push) Successful in 38s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 12s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m12s

- Added a check to ensure that the source slot is not the same as the target slot when moving sections across slots, enhancing the logic for section management and preventing unnecessary operations.
This commit is contained in:
Lars 2026-05-16 08:05:10 +02:00
parent 736656bde8
commit f1c470a8a3

View File

@ -773,7 +773,8 @@ export default function TrainingUnitSectionsEditor({
if (
typeof onMoveSectionsAcrossSlots === 'function' &&
sectionToSlot >= 0 &&
fromSlot >= 0
fromSlot >= 0 &&
fromSlot !== sectionToSlot
) {
return { kind: 'crossSlot', fromSi, fromSlot }
}
@ -937,7 +938,8 @@ export default function TrainingUnitSectionsEditor({
if (
typeof onMoveSectionsAcrossSlots === 'function' &&
sectionToSlot >= 0 &&
fromSlot >= 0
fromSlot >= 0 &&
fromSlot !== sectionToSlot
) {
onMoveSectionsAcrossSlots({
fromSlot,
@ -1011,7 +1013,8 @@ export default function TrainingUnitSectionsEditor({
if (
typeof onMoveSectionsAcrossSlots === 'function' &&
sectionToSlot >= 0 &&
fromSlot >= 0
fromSlot >= 0 &&
fromSlot !== sectionToSlot
) {
onMoveSectionsAcrossSlots({
fromSlot,