Refactor enrichFrameworkSlotSections to improve section handling in training framework
All checks were successful
Deploy Development / deploy (push) Successful in 38s
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 33s
Test Suite / playwright-tests (push) Successful in 1m8s

- 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.
This commit is contained in:
Lars 2026-05-16 07:53:05 +02:00
parent e441f59bff
commit 736656bde8

View File

@ -48,14 +48,10 @@ function emptySlot() {
async function enrichFrameworkSlotSections(slots) { async function enrichFrameworkSlotSections(slots) {
const out = [] const out = []
for (const s of slots || []) { for (const s of slots || []) {
const sec = normalizeUnitToForm({ const baseSecs = s.sections && s.sections.length ? s.sections : [defaultSection('Ablauf')]
sections: s.sections,
exercises: s.exercises,
phases: s.phases,
})
out.push({ out.push({
...s, ...s,
sections: await enrichSectionsWithVariants(sec), sections: await enrichSectionsWithVariants(baseSecs),
}) })
} }
return out return out