Update version to 0.8.148 and enhance training plan template functionality
Deploy Development / deploy (push) Successful in 41s
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 1m7s

- Incremented app version to 0.8.148 and updated changelog to reflect new features.
- Improved the training plan template structure by adding a preview of sections, including support for split sessions.
- Introduced a new editing page for training plan templates, allowing users to modify templates directly.
- Enhanced the TrainingPlanningPageRoot to include a description field when saving templates, improving user guidance.
- Updated permissions to allow editing of training plan templates based on user roles.
This commit is contained in:
Lars committed 2026-05-19 10:13:26 +02:00
1 parent 1684892bcb
commit f15aa7c415
10 files changed
+583 -32

No files matched your search

@@ -1180,6 +1180,66 @@ export function templateSectionsPayloadFromFormSections(sections) {
})
}
/** Kurzdarstellung der Vorlagen-Gliederung (Ganzgruppe + Split-Streams) für Listen/Übersicht. */
export function formatPlanTemplateStructurePreview(templateSections) {
const rows = Array.isArray(templateSections) ? [...templateSections] : []
if (!rows.length) {
return { lines: [], hasSplit: false, isEmpty: true }
}
rows.sort((a, b) => (a.order_index ?? 0) - (b.order_index ?? 0))
const lines = []
let hasSplit = false
let i = 0
while (i < rows.length) {
const r0 = rows[i]
const pk0 = String(r0.phase_kind || 'whole_group').toLowerCase().trim()
const poi0 = Number(r0.phase_order_index)
const phaseOrder = Number.isFinite(poi0) ? poi0 : 0
const run = []
while (i < rows.length) {
const r = rows[i]
const pk = String(r.phase_kind || 'whole_group').toLowerCase().trim()
const poi = Number(r.phase_order_index)
const phaseOi = Number.isFinite(poi) ? poi : 0
if (pk !== pk0 || phaseOi !== phaseOrder) break
run.push(r)
i += 1
}
if (pk0 === 'parallel') {
hasSplit = true
const byStream = new Map()
for (const r of run) {
const soRaw = r.parallel_stream_order_index
const so = soRaw == null || soRaw === '' ? 0 : Number(soRaw)
const streamKey = Number.isFinite(so) ? so : 0
if (!byStream.has(streamKey)) byStream.set(streamKey, [])
byStream.get(streamKey).push(r)
}
const streamParts = [...byStream.keys()]
.sort((a, b) => a - b)
.map((so) => {
const titles = byStream
.get(so)
.map((r) => (r.title || '').trim() || 'Abschnitt')
return `Gruppe ${so + 1}: ${titles.join(' · ')}`
})
lines.push({
kind: 'parallel',
label: phaseOrder > 0 ? `Split · Phase ${phaseOrder}` : 'Split-Session',
detail: streamParts.join(' │ '),
})
} else {
const titles = run.map((r) => (r.title || '').trim() || 'Abschnitt')
lines.push({
kind: 'whole_group',
label: phaseOrder > 0 ? `Ganzgruppe · Phase ${phaseOrder}` : 'Ganzgruppe',
detail: titles.join(' → '),
})
}
}
return { lines, hasSplit, isEmpty: false }
}
/** GET-Vorlage → Editor-Abschnitte mit planLoc (Split-Sessions). */
export function formSectionsFromPlanTemplateRows(templateSections) {
const rows = Array.isArray(templateSections) ? [...templateSections] : []