feat(version): bump to 0.8.103 and enhance planning method profile integration
Deploy Development / deploy (push) Successful in 38s
Test Suite / pytest-backend (push) Successful in 35s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 11s
Test Suite / playwright-tests (push) Successful in 59s
Deploy Development / deploy (push) Successful in 38s
Test Suite / pytest-backend (push) Successful in 35s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 11s
Test Suite / playwright-tests (push) Successful in 59s
- Updated app version to 0.8.103, reflecting recent enhancements in training planning. - Incremented database schema version to 20260512057, ensuring compatibility with new features. - Introduced optional `planning_method_profile` for combination exercises, allowing for detailed planning and coaching support. - Enhanced frontend components to manage and display planning method profiles effectively in the Training Unit Sections Editor and ExerciseFullContent. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
12fd3926b2
commit
4e654e50c0
9 files changed
+233
-17
No files matched your search
@@ -0,0 +1,26 @@
|
||||
/** Effektives Ablaufprofil für Kombination im Coach/in der Planung */
|
||||
|
||||
export function effectiveComboMethodProfile(catalogDict, planningSnapshot) {
|
||||
const cat =
|
||||
catalogDict && typeof catalogDict === 'object' && !Array.isArray(catalogDict)
|
||||
? catalogDict
|
||||
: {}
|
||||
if (
|
||||
planningSnapshot !== null &&
|
||||
planningSnapshot !== undefined &&
|
||||
typeof planningSnapshot === 'object' &&
|
||||
!Array.isArray(planningSnapshot)
|
||||
) {
|
||||
return { ...planningSnapshot }
|
||||
}
|
||||
return { ...cat }
|
||||
}
|
||||
|
||||
export function comboPlanningProfileJsonForEditor(catalogDict, planningSnapshot) {
|
||||
const o = effectiveComboMethodProfile(catalogDict, planningSnapshot)
|
||||
try {
|
||||
return JSON.stringify(Object.keys(o).length ? o : {})
|
||||
} catch {
|
||||
return '{}'
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ export function sectionsToPutPayload(unit, durationOverridesByItemId = {}) {
|
||||
else actual = typeof actual === 'number' ? actual : parseInt(String(actual), 10)
|
||||
if (actual !== null && !Number.isFinite(actual)) actual = null
|
||||
|
||||
return {
|
||||
const row = {
|
||||
item_type: 'exercise',
|
||||
order_index: it.order_index ?? ii,
|
||||
exercise_id: parseInt(String(eid), 10),
|
||||
@@ -92,6 +92,13 @@ export function sectionsToPutPayload(unit, durationOverridesByItemId = {}) {
|
||||
notes: trimOrNull(it.notes),
|
||||
modifications: trimOrNull(it.modifications),
|
||||
}
|
||||
if (isCombo) {
|
||||
const pmp = it.planning_method_profile
|
||||
if (pmp != null && typeof pmp === 'object' && !Array.isArray(pmp)) {
|
||||
row.planning_method_profile = { ...pmp }
|
||||
}
|
||||
}
|
||||
return row
|
||||
})
|
||||
.filter(Boolean),
|
||||
}))
|
||||
|
||||
@@ -4,6 +4,18 @@ export function defaultSection(title = 'Hauptteil') {
|
||||
return { title, guidance_notes: '', items: [] }
|
||||
}
|
||||
|
||||
function normalizeCatalogMethodProfile(cp) {
|
||||
if (cp && typeof cp === 'object' && !Array.isArray(cp)) return { ...cp }
|
||||
return {}
|
||||
}
|
||||
|
||||
/** NULL = Planung folgt Katalogprofil der Übung */
|
||||
function normalizePlanningMethodProfile(pm) {
|
||||
if (pm == null) return null
|
||||
if (typeof pm === 'object' && !Array.isArray(pm)) return { ...pm }
|
||||
return null
|
||||
}
|
||||
|
||||
export function exerciseRow() {
|
||||
return {
|
||||
item_type: 'exercise',
|
||||
@@ -18,6 +30,9 @@ export function exerciseRow() {
|
||||
modifications: '',
|
||||
source_training_module_id: '',
|
||||
source_module_title: '',
|
||||
catalog_method_archetype: '',
|
||||
catalog_method_profile: {},
|
||||
planning_method_profile: null,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,16 +44,20 @@ export async function hydrateExercisePlanningRow(exercise) {
|
||||
if (!id) return null
|
||||
let meta = {}
|
||||
|
||||
async function fetchFull() {
|
||||
let full
|
||||
|
||||
async function ensureFull() {
|
||||
if (full !== undefined) return full
|
||||
try {
|
||||
return await api.getExercise(id)
|
||||
full = await api.getExercise(id)
|
||||
} catch {
|
||||
return null
|
||||
full = null
|
||||
}
|
||||
return full
|
||||
}
|
||||
|
||||
if (!variants.length) {
|
||||
const full = await fetchFull()
|
||||
await ensureFull()
|
||||
if (full) {
|
||||
variants = Array.isArray(full.variants) ? full.variants : []
|
||||
title = full.title || title
|
||||
@@ -48,6 +67,8 @@ export async function hydrateExercisePlanningRow(exercise) {
|
||||
exercise_club_id: full.club_id ?? null,
|
||||
exercise_created_by: full.created_by ?? null,
|
||||
exercise_status: full.status || 'draft',
|
||||
catalog_method_archetype: typeof full.method_archetype === 'string' ? full.method_archetype.trim() : '',
|
||||
catalog_method_profile: normalizeCatalogMethodProfile(full.method_profile),
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -62,7 +83,7 @@ export async function hydrateExercisePlanningRow(exercise) {
|
||||
meta.exercise_created_by == null ||
|
||||
exerciseKind == null
|
||||
) {
|
||||
const full = await fetchFull()
|
||||
await ensureFull()
|
||||
if (full) {
|
||||
if (meta.exercise_visibility == null) meta.exercise_visibility = full.visibility || 'private'
|
||||
if (meta.exercise_club_id == null) meta.exercise_club_id = full.club_id ?? null
|
||||
@@ -89,6 +110,15 @@ export async function hydrateExercisePlanningRow(exercise) {
|
||||
row.variants = variants
|
||||
}
|
||||
Object.assign(row, meta)
|
||||
if (row.exercise_kind === 'combination') {
|
||||
if (full === undefined) await ensureFull()
|
||||
if (full) {
|
||||
row.catalog_method_archetype =
|
||||
typeof full.method_archetype === 'string' ? full.method_archetype.trim() : ''
|
||||
row.catalog_method_profile = normalizeCatalogMethodProfile(full.method_profile)
|
||||
}
|
||||
}
|
||||
row.planning_method_profile = null
|
||||
return row
|
||||
}
|
||||
|
||||
@@ -147,6 +177,9 @@ export function normalizeUnitToForm(fullUnit) {
|
||||
: '',
|
||||
notes: it.notes ?? '',
|
||||
modifications: it.modifications ?? '',
|
||||
catalog_method_archetype: String(it.catalog_method_archetype ?? '').trim(),
|
||||
catalog_method_profile: normalizeCatalogMethodProfile(it.catalog_method_profile),
|
||||
planning_method_profile: normalizePlanningMethodProfile(it.planning_method_profile),
|
||||
...(smEx != null
|
||||
? {
|
||||
source_training_module_id: smEx,
|
||||
@@ -186,6 +219,9 @@ export function normalizeUnitToForm(fullUnit) {
|
||||
: '',
|
||||
notes: ex.notes ?? '',
|
||||
modifications: ex.modifications ?? '',
|
||||
catalog_method_archetype: String(ex.catalog_method_archetype ?? '').trim(),
|
||||
catalog_method_profile: normalizeCatalogMethodProfile(ex.catalog_method_profile),
|
||||
planning_method_profile: normalizePlanningMethodProfile(ex.planning_method_profile),
|
||||
}
|
||||
}),
|
||||
},
|
||||
@@ -217,6 +253,8 @@ export async function enrichSectionsWithVariants(sections) {
|
||||
club_id: ex.club_id ?? null,
|
||||
created_by: ex.created_by ?? null,
|
||||
status: ex.status || 'draft',
|
||||
method_archetype: typeof ex.method_archetype === 'string' ? ex.method_archetype.trim() : '',
|
||||
method_profile: normalizeCatalogMethodProfile(ex.method_profile),
|
||||
})
|
||||
} catch {
|
||||
cache.set(id, {
|
||||
@@ -227,6 +265,8 @@ export async function enrichSectionsWithVariants(sections) {
|
||||
club_id: null,
|
||||
created_by: null,
|
||||
status: 'draft',
|
||||
method_archetype: '',
|
||||
method_profile: {},
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -240,8 +280,18 @@ export async function enrichSectionsWithVariants(sections) {
|
||||
if (!c) return it
|
||||
const ek = String(c.exercise_kind || 'simple').toLowerCase().trim()
|
||||
const isCombo = ek === 'combination'
|
||||
const itemCatalog = normalizeCatalogMethodProfile(it.catalog_method_profile)
|
||||
const catalog_method_profile =
|
||||
Object.keys(itemCatalog).length > 0
|
||||
? itemCatalog
|
||||
: normalizeCatalogMethodProfile(c.method_profile)
|
||||
const rowArche = String(it.catalog_method_archetype ?? '').trim()
|
||||
const catalog_method_archetype = rowArche || String(c.method_archetype ?? '').trim()
|
||||
return {
|
||||
...it,
|
||||
catalog_method_archetype,
|
||||
catalog_method_profile,
|
||||
planning_method_profile: normalizePlanningMethodProfile(it.planning_method_profile),
|
||||
exercise_kind: isCombo ? 'combination' : 'simple',
|
||||
exercise_title: it.exercise_title || c.title,
|
||||
exercise_variant_id: isCombo ? '' : it.exercise_variant_id,
|
||||
@@ -296,6 +346,12 @@ export function buildSectionsPayload(sections) {
|
||||
notes: it.notes?.trim() ? it.notes.trim() : null,
|
||||
modifications: it.modifications?.trim() ? it.modifications.trim() : null,
|
||||
}
|
||||
if (isCombo) {
|
||||
const pmp = it.planning_method_profile
|
||||
if (pmp != null && typeof pmp === 'object' && !Array.isArray(pmp)) {
|
||||
rowEx.planning_method_profile = { ...pmp }
|
||||
}
|
||||
}
|
||||
if (smEx != null) rowEx.source_training_module_id = smEx
|
||||
return rowEx
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user