Update version information and add training duration features
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 38s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m22s
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 38s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m22s
- Bumped application version to 0.8.150 and updated build date and database schema version. - Introduced new SQL migration for planned duration fields in training units and sections. - Added functions to handle focus areas and style directions in training framework programs. - Enhanced training planning components to support planned duration input and display. - Updated frontend components to manage and display planned duration for training units and sections.
This commit is contained in:
1 parent
ab612a5335
commit
5a8a212f40
12 files changed
+629
-149
No files matched your search
@@ -2,7 +2,7 @@ import api from './api'
|
||||
import { sortCombinationSlotsForDisplay } from '../constants/combinationArchetypes'
|
||||
|
||||
export function defaultSection(title = 'Hauptteil') {
|
||||
return { title, guidance_notes: '', items: [] }
|
||||
return { title, guidance_notes: '', planned_duration_min: '', items: [] }
|
||||
}
|
||||
|
||||
/** Standard-`planLoc` für eine Ganzgruppen-Phase (Editor-Breakout-UI). */
|
||||
@@ -440,6 +440,10 @@ function normalizePhasesToFormSections(fullUnit) {
|
||||
out.push({
|
||||
title: sec.title,
|
||||
guidance_notes: sec.guidance_notes || '',
|
||||
planned_duration_min:
|
||||
sec.planned_duration_min != null && sec.planned_duration_min !== undefined
|
||||
? String(sec.planned_duration_min)
|
||||
: '',
|
||||
items: formItemsFromApiItems(sec.items),
|
||||
planLoc: { ...streamLoc },
|
||||
})
|
||||
@@ -459,6 +463,10 @@ function normalizePhasesToFormSections(fullUnit) {
|
||||
out.push({
|
||||
title: sec.title,
|
||||
guidance_notes: sec.guidance_notes || '',
|
||||
planned_duration_min:
|
||||
sec.planned_duration_min != null && sec.planned_duration_min !== undefined
|
||||
? String(sec.planned_duration_min)
|
||||
: '',
|
||||
items: formItemsFromApiItems(sec.items),
|
||||
planLoc: { ...loc },
|
||||
})
|
||||
@@ -476,6 +484,10 @@ export function normalizeUnitToForm(fullUnit) {
|
||||
return fullUnit.sections.map((sec) => ({
|
||||
title: sec.title,
|
||||
guidance_notes: sec.guidance_notes || '',
|
||||
planned_duration_min:
|
||||
sec.planned_duration_min != null && sec.planned_duration_min !== undefined
|
||||
? String(sec.planned_duration_min)
|
||||
: '',
|
||||
items: formItemsFromApiItems(sec.items),
|
||||
}))
|
||||
}
|
||||
@@ -665,6 +677,7 @@ export function buildOneSectionPayload(sec, orderIndex) {
|
||||
order_index: orderIndex,
|
||||
title: (sec.title || '').trim() || 'Abschnitt',
|
||||
guidance_notes: sec.guidance_notes?.trim() ? sec.guidance_notes.trim() : null,
|
||||
planned_duration_min: parseMin(sec.planned_duration_min),
|
||||
items: (sec.items || [])
|
||||
.map((it, ii) => {
|
||||
if (it.item_type === 'note') {
|
||||
@@ -1173,6 +1186,7 @@ export function templateSectionsPayloadFromFormSections(sections) {
|
||||
order_index: si,
|
||||
title: (s.title || '').trim() || `Abschnitt ${si + 1}`,
|
||||
guidance_text: s.guidance_notes?.trim() ? s.guidance_notes.trim() : null,
|
||||
planned_duration_min: parseMin(s.planned_duration_min),
|
||||
phase_kind: pk,
|
||||
phase_order_index: poi,
|
||||
parallel_stream_order_index: pso,
|
||||
@@ -1263,6 +1277,10 @@ export function formSectionsFromPlanTemplateRows(templateSections) {
|
||||
return {
|
||||
title: s.title || 'Abschnitt',
|
||||
guidance_notes: s.guidance_text || '',
|
||||
planned_duration_min:
|
||||
s.planned_duration_min != null && s.planned_duration_min !== undefined
|
||||
? String(s.planned_duration_min)
|
||||
: '',
|
||||
items: [],
|
||||
planLoc,
|
||||
}
|
||||
@@ -1342,9 +1360,34 @@ export async function insertTrainingModuleIntoPlanningSections({
|
||||
}
|
||||
|
||||
export function sectionPlannedMinutes(sec) {
|
||||
const sectionMin = parseMin(sec?.planned_duration_min)
|
||||
if (sectionMin != null && sectionMin > 0) return sectionMin
|
||||
return (sec.items || []).reduce((sum, it) => {
|
||||
if (it.item_type !== 'exercise') return sum
|
||||
const m = parseMin(it.planned_duration_min)
|
||||
return sum + (m || 0)
|
||||
}, 0)
|
||||
}
|
||||
|
||||
/** Abschnitt unterhalb einer Parallel-Phase in die Ganzgruppe darunter verschieben. */
|
||||
export function reorderSectionAfterParallelRunAsWholeGroup(prev, fromI, phaseOrderIndex) {
|
||||
const po = Number(phaseOrderIndex) || 0
|
||||
const idxs = indicesOfParallelPhase(prev, po)
|
||||
if (!idxs.length || fromI < 0 || fromI >= (prev?.length ?? 0)) return prev
|
||||
const lg = idxs[idxs.length - 1]
|
||||
const arr = [...prev]
|
||||
const [moved] = arr.splice(fromI, 1)
|
||||
let insertAt = lg + 1
|
||||
if (fromI < insertAt) insertAt -= 1
|
||||
insertAt = Math.max(0, Math.min(insertAt, arr.length))
|
||||
const below = insertAt < arr.length ? arr[insertAt] : undefined
|
||||
let planLocNext
|
||||
if (below?.planLoc?.phaseKind === 'whole_group') {
|
||||
planLocNext = { ...below.planLoc }
|
||||
} else {
|
||||
const mx = maxPhaseOrderIndexFromSections(arr)
|
||||
planLocNext = defaultPlanLocWholeGroup(mx + 1)
|
||||
}
|
||||
arr.splice(insertAt, 0, { ...moved, planLoc: planLocNext })
|
||||
return arr
|
||||
}
|
||||
Reference in new issue
Block a user