feat(combo-planning): replace summarizeSlotProfileBrief with effectiveStationTimingSummary
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 12s
Test Suite / playwright-tests (push) Successful in 57s

- Updated CombinationCoachSlots, CombinationPlanBracket, and TrainingUnitSectionsEditor components to utilize effectiveStationTimingSummary for improved timing display.
- Adjusted station title handling to enhance clarity and consistency across components.
- Refactored utility functions to streamline slot timing summaries and improve overall user experience in combination planning.
This commit is contained in:
Lars committed 2026-05-13 14:34:17 +02:00
1 parent ed15f73727
commit 79dabbca5a
4 files changed
+92 -11

No files matched your search

@@ -322,6 +322,82 @@ export function summarizeSlotProfileBrief(r) {
return bits.join(' · ')
}
function globalTimingHintsForArchetype(arch, mp) {
if (!mp || typeof mp !== 'object' || Array.isArray(mp)) return []
const bits = []
switch (arch) {
case 'circuit_rotate_time':
if (mp.work_seconds != null && mp.work_seconds !== '') bits.push(`${mp.work_seconds}s Arbeit je Station`)
if (mp.transition_seconds != null && mp.transition_seconds !== '')
bits.push(`Rotation ${mp.transition_seconds}s`)
if (mp.rest_seconds != null && mp.rest_seconds !== '') bits.push(`Pause ${mp.rest_seconds}s`)
if (mp.rounds != null && mp.rounds !== '') bits.push(`${mp.rounds} Umlauf‑Runden`)
break
case 'sequence_linear':
if (mp.hint_step_duration_sec != null && mp.hint_step_duration_sec !== '')
bits.push(`~${mp.hint_step_duration_sec}s je Station`)
if (mp.rounds != null && mp.rounds !== '') bits.push(`${mp.rounds} Sequenz‑Durchläufe`)
if (mp.block_intro_sec != null && mp.block_intro_sec !== '') bits.push(`Block‑Intro ${mp.block_intro_sec}s`)
break
case 'time_domain_interval':
if (mp.work_seconds != null && mp.work_seconds !== '') bits.push(`${mp.work_seconds}s Intervall‑Arbeit`)
if (mp.rest_seconds != null && mp.rest_seconds !== '') bits.push(`${mp.rest_seconds}s Erholung`)
if (mp.interval_rounds != null && mp.interval_rounds !== '') bits.push(`${mp.interval_rounds} Intervall‑Zyklen`)
break
case 'pair_superset':
if (mp.work_seconds_per_side != null && mp.work_seconds_per_side !== '')
bits.push(`${mp.work_seconds_per_side}s Arbeit`)
if (mp.switch_seconds != null && mp.switch_seconds !== '') bits.push(`Wechsel ${mp.switch_seconds}s`)
break
case 'station_parcour':
if (mp.rounds != null && mp.rounds !== '') bits.push(`${mp.rounds} Parcours‑Runden`)
break
case 'circuit_all_parallel':
if (mp.rounds != null && mp.rounds !== '') bits.push(`${mp.rounds} Runden`)
if (mp.explain_before_seconds != null && mp.explain_before_seconds !== '')
bits.push(`Erklärung ${mp.explain_before_seconds}s`)
break
default:
break
}
return bits
}
function isWeakSlotTimingSummary(txt) {
if (!txt || typeof txt !== 'string') return true
const t = txt.trim()
return t === 'Zeit' || t === 'Coach' || t === 'Ziel‑Wdh.'
}
/**
* Stationszeile für Lesetext: Slot‑Zeiten + bei Bedarf globale Eckdaten (Zirkel‑Sekunden, Runden …).
*/
export function effectiveStationTimingSummary(archetypeKey, profileObj, slotRow) {
const arch = typeof archetypeKey === 'string' ? archetypeKey.trim() : ''
const mp = profileObj && typeof profileObj === 'object' && !Array.isArray(profileObj) ? profileObj : {}
const slotTxt = summarizeSlotProfileBrief(slotRow)
const hints = globalTimingHintsForArchetype(arch, mp)
const hintStr = hints.join(' · ')
if (!isWeakSlotTimingSummary(slotTxt)) {
const extras = []
for (const h of hints) {
if (
/Runden|Durchläufe|Zyklen|Umlauf/i.test(h) &&
slotTxt &&
!/Runden|Serien|×|\d+s Arbeit|\d+s Erholung|\d+s Intervall/i.test(slotTxt)
) {
extras.push(h)
}
}
return extras.length ? `${slotTxt} · ${extras.join(' · ')}` : slotTxt
}
if (hintStr) return hintStr
if (slotTxt) return slotTxt
return null
}
function normalizeOptionalNonNegInt(v) {
if (v === '' || v === undefined || v === null) return undefined
const n = typeof v === 'number' ? v : parseInt(String(v), 10)