feat(training-unit-editor): integrate new summary function and enhance combination exercise display
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 56s
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 56s
- Introduced `summarizeSlotProfileBrief` utility for concise slot profile summaries, improving the display of combination exercises. - Updated `CombinationCoachSlots` and `ExercisePeekModal` components to utilize the new summary function for better user experience. - Enhanced `TrainingUnitSectionsEditor` to manage combination slots more effectively, including improved title handling and display options. - Adjusted `TrainingPlanningPage` to support additional peek context for combination exercises, streamlining the planning process. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
805ad3c5a5
commit
5dc93d9a8c
6 files changed
+298
-59
No files matched your search
@@ -276,6 +276,48 @@ export async function enrichSectionsWithVariants(sections) {
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
const titleById = new Map()
|
||||
for (const id of unique) {
|
||||
const row = cache.get(id)
|
||||
const t = (row?.title || '').trim()
|
||||
if (t) titleById.set(Number(id), t)
|
||||
}
|
||||
const comboCandidateExtra = new Set()
|
||||
for (const id of unique) {
|
||||
const row = cache.get(id)
|
||||
if (String(row?.exercise_kind || '').toLowerCase().trim() !== 'combination') continue
|
||||
for (const slot of row.combination_slots || []) {
|
||||
for (const raw of slot.candidate_exercise_ids || []) {
|
||||
const n = typeof raw === 'number' ? raw : parseInt(String(raw), 10)
|
||||
if (Number.isFinite(n) && !titleById.has(n)) comboCandidateExtra.add(n)
|
||||
}
|
||||
}
|
||||
}
|
||||
await Promise.all(
|
||||
[...comboCandidateExtra].map(async (cid) => {
|
||||
try {
|
||||
const ex = await api.getExercise(cid)
|
||||
titleById.set(cid, ((ex.title || '').trim() || `Übung #${cid}`))
|
||||
} catch {
|
||||
titleById.set(cid, `Übung #${cid}`)
|
||||
}
|
||||
}),
|
||||
)
|
||||
|
||||
function comboMemberTitleByIdForSlots(slots) {
|
||||
const o = {}
|
||||
for (const slot of slots || []) {
|
||||
for (const raw of slot.candidate_exercise_ids || []) {
|
||||
const n = typeof raw === 'number' ? raw : parseInt(String(raw), 10)
|
||||
if (!Number.isFinite(n)) continue
|
||||
const key = String(n)
|
||||
if (!o[key]) o[key] = titleById.get(n) || `Übung #${n}`
|
||||
}
|
||||
}
|
||||
return o
|
||||
}
|
||||
|
||||
return sections.map((sec) => ({
|
||||
...sec,
|
||||
items: (sec.items || []).map((it) => {
|
||||
@@ -306,7 +348,7 @@ export async function enrichSectionsWithVariants(sections) {
|
||||
exercise_club_id: c.club_id,
|
||||
exercise_created_by: c.created_by,
|
||||
exercise_status: c.status,
|
||||
...(isCombo ? { combination_slots: c.combination_slots || [] } : {}),
|
||||
...(isCombo ? { combination_slots: c.combination_slots || [], combo_member_title_by_id: comboMemberTitleByIdForSlots(c.combination_slots || []) } : {}),
|
||||
}
|
||||
}),
|
||||
}))
|
||||
|
||||
Reference in new issue
Block a user