Update version to 0.8.141 and enhance training plan template handling
Deploy Development / deploy (push) Successful in 44s
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 1m13s
Deploy Development / deploy (push) Successful in 44s
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 1m13s
- Incremented app version to 0.8.141 and updated build date to 2026-05-14. - Modified the planning module version to 0.12.0, improving template section handling with phase metadata. - Introduced new functions for normalizing and inserting training plan template sections, ensuring accurate phase representation during saves. - Updated frontend components to utilize new utility functions for managing training plan templates, enhancing user experience and data integrity.
This commit is contained in:
1 parent
79e748b470
commit
c3eb5a62c4
5 files changed
+282
-58
No files matched your search
@@ -19,6 +19,8 @@ import {
|
||||
buildPlanPayloadForSave,
|
||||
hydrateExercisePlanningRow,
|
||||
insertTrainingModuleIntoPlanningSections,
|
||||
templateSectionsPayloadFromFormSections,
|
||||
formSectionsFromPlanTemplateRows,
|
||||
} from '../../utils/trainingUnitSectionsForm'
|
||||
import {
|
||||
addDaysIsoDate,
|
||||
@@ -549,12 +551,8 @@ function TrainingPlanningPageRoot() {
|
||||
setFormData((fd) => ({
|
||||
...fd,
|
||||
sections: (tpl.sections || []).length
|
||||
? tpl.sections.map((s) => ({
|
||||
title: s.title,
|
||||
guidance_notes: s.guidance_text || '',
|
||||
items: []
|
||||
}))
|
||||
: [defaultSection()]
|
||||
? formSectionsFromPlanTemplateRows(tpl.sections)
|
||||
: [defaultSection()],
|
||||
}))
|
||||
} catch (err) {
|
||||
toast.error('Vorlage laden: ' + err.message)
|
||||
@@ -651,10 +649,7 @@ function TrainingPlanningPageRoot() {
|
||||
try {
|
||||
await api.createTrainingPlanTemplate({
|
||||
name: name.trim(),
|
||||
sections: formData.sections.map((s) => ({
|
||||
title: s.title || 'Abschnitt',
|
||||
guidance_text: s.guidance_notes?.trim() ? s.guidance_notes.trim() : null
|
||||
}))
|
||||
sections: templateSectionsPayloadFromFormSections(formData.sections),
|
||||
})
|
||||
await loadPlanTemplates()
|
||||
toast.success('Vorlage gespeichert.')
|
||||
|
||||
@@ -1161,6 +1161,54 @@ export function buildPlanPayloadForSave(sections) {
|
||||
return buildPhasesPayloadFromFlat(list)
|
||||
}
|
||||
|
||||
/** Payload-Zeilen für POST/PUT /api/training-plan-templates (inkl. Split-/Phasen-Metadaten). */
|
||||
export function templateSectionsPayloadFromFormSections(sections) {
|
||||
const norm = inheritPlanLocForPhasedSave(Array.isArray(sections) ? sections : [])
|
||||
return norm.map((s, si) => {
|
||||
const canon = canonicalPlanLocForPhasedSave(s.planLoc)
|
||||
const pk = canon?.phaseKind === 'parallel' ? 'parallel' : 'whole_group'
|
||||
const poi = canon?.phaseOrderIndex ?? 0
|
||||
const pso = canon?.phaseKind === 'parallel' ? (canon.parallelStreamOrderIndex ?? 0) : null
|
||||
return {
|
||||
order_index: si,
|
||||
title: (s.title || '').trim() || `Abschnitt ${si + 1}`,
|
||||
guidance_text: s.guidance_notes?.trim() ? s.guidance_notes.trim() : null,
|
||||
phase_kind: pk,
|
||||
phase_order_index: poi,
|
||||
parallel_stream_order_index: pso,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** GET-Vorlage → Editor-Abschnitte mit planLoc (Split-Sessions). */
|
||||
export function formSectionsFromPlanTemplateRows(templateSections) {
|
||||
const rows = Array.isArray(templateSections) ? [...templateSections] : []
|
||||
rows.sort((a, b) => (a.order_index ?? 0) - (b.order_index ?? 0))
|
||||
if (!rows.length) return [defaultSection()]
|
||||
return rows.map((s) => {
|
||||
const pk = String(s.phase_kind || 'whole_group').toLowerCase().trim()
|
||||
const poiRaw = s.phase_order_index
|
||||
const poi = poiRaw == null || poiRaw === '' ? 0 : Number(poiRaw)
|
||||
const phaseOrderIndex = Number.isFinite(poi) ? poi : 0
|
||||
const soRaw = s.parallel_stream_order_index
|
||||
let planLoc
|
||||
if (pk === 'parallel') {
|
||||
const so = soRaw == null || soRaw === '' ? 0 : Number(soRaw)
|
||||
planLoc = {
|
||||
...defaultPlanLocParallel(phaseOrderIndex, Number.isFinite(so) ? so : 0),
|
||||
}
|
||||
} else {
|
||||
planLoc = { ...defaultPlanLocWholeGroup(phaseOrderIndex) }
|
||||
}
|
||||
return {
|
||||
title: s.title || 'Abschnitt',
|
||||
guidance_notes: s.guidance_text || '',
|
||||
items: [],
|
||||
planLoc,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** Fügt die Positionen eines Moduls in lokale Abschnitte ein (wie eine Übung, ohne Zwischenspeichern der Einheit). */
|
||||
export async function insertTrainingModuleIntoPlanningSections({
|
||||
sections,
|
||||
|
||||
Reference in new issue
Block a user