From 736656bde8d501f208fec58e28b6f88c5d63ac5d Mon Sep 17 00:00:00 2001 From: Lars Date: Sat, 16 May 2026 07:53:05 +0200 Subject: [PATCH] Refactor enrichFrameworkSlotSections to improve section handling in training framework - Updated the enrichFrameworkSlotSections function to utilize default sections when no sections are provided, enhancing data integrity. - Simplified the normalization process by directly using base sections, improving code clarity and maintainability. --- frontend/src/pages/TrainingFrameworkProgramEditPage.jsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/frontend/src/pages/TrainingFrameworkProgramEditPage.jsx b/frontend/src/pages/TrainingFrameworkProgramEditPage.jsx index 3d29262..600b55a 100644 --- a/frontend/src/pages/TrainingFrameworkProgramEditPage.jsx +++ b/frontend/src/pages/TrainingFrameworkProgramEditPage.jsx @@ -48,14 +48,10 @@ function emptySlot() { async function enrichFrameworkSlotSections(slots) { const out = [] for (const s of slots || []) { - const sec = normalizeUnitToForm({ - sections: s.sections, - exercises: s.exercises, - phases: s.phases, - }) + const baseSecs = s.sections && s.sections.length ? s.sections : [defaultSection('Ablauf')] out.push({ ...s, - sections: await enrichSectionsWithVariants(sec), + sections: await enrichSectionsWithVariants(baseSecs), }) } return out