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
@@ -26,6 +26,7 @@ import {
|
||||
reorderSectionBeforeParallelRunAsWholeGroup,
|
||||
reorderSectionAsFirstInParallelStream,
|
||||
} from '../utils/trainingUnitSectionsForm'
|
||||
import { parseDurationInput } from '../utils/trainingDurationUtils'
|
||||
|
||||
const DND_FW_SLOT = 'application/x-shinkan-framework-slot'
|
||||
|
||||
@@ -52,7 +53,7 @@ function emptyGoal() {
|
||||
|
||||
|
||||
function emptySlot() {
|
||||
return { title: '', notes: '', sections: [defaultSection('Ablauf')] }
|
||||
return { title: '', notes: '', planned_duration_min: '', sections: [defaultSection('Ablauf')] }
|
||||
}
|
||||
|
||||
async function enrichFrameworkSlotSections(slots) {
|
||||
@@ -79,12 +80,10 @@ function defaultForm() {
|
||||
return {
|
||||
title: '',
|
||||
description: '',
|
||||
focus_area_id: '',
|
||||
style_direction_id: '',
|
||||
focus_area_ids: [],
|
||||
style_direction_ids: [],
|
||||
training_type_ids: [],
|
||||
target_group_ids: [],
|
||||
planned_period_start: '',
|
||||
planned_period_end: '',
|
||||
visibility: 'private',
|
||||
club_id: '',
|
||||
goals: [emptyGoal()],
|
||||
@@ -105,12 +104,10 @@ function frameworkDraftSnapshot(fm) {
|
||||
return JSON.stringify({
|
||||
title: (fm.title || '').trim(),
|
||||
description: (fm.description || '').trim(),
|
||||
focus_area_id: fm.focus_area_id || '',
|
||||
style_direction_id: fm.style_direction_id || '',
|
||||
focus_area_ids: [...(fm.focus_area_ids || [])].map(String).sort(),
|
||||
style_direction_ids: [...(fm.style_direction_ids || [])].map(String).sort(),
|
||||
training_type_ids: [...(fm.training_type_ids || [])].map(String).sort(),
|
||||
target_group_ids: [...(fm.target_group_ids || [])].map(String).sort(),
|
||||
planned_period_start: fm.planned_period_start || '',
|
||||
planned_period_end: fm.planned_period_end || '',
|
||||
visibility: (fm.visibility || '').trim(),
|
||||
club_id: (fm.club_id || '').trim(),
|
||||
goals: goalsNorm,
|
||||
@@ -123,16 +120,22 @@ function serverFrameworkToForm(fw) {
|
||||
return {
|
||||
title: fw.title || '',
|
||||
description: fw.description || '',
|
||||
focus_area_id: fw.focus_area_id != null ? String(fw.focus_area_id) : '',
|
||||
style_direction_id: fw.style_direction_id != null ? String(fw.style_direction_id) : '',
|
||||
focus_area_ids: Array.isArray(fw.focus_area_ids)
|
||||
? fw.focus_area_ids.map((x) => String(x))
|
||||
: fw.focus_area_id != null
|
||||
? [String(fw.focus_area_id)]
|
||||
: [],
|
||||
style_direction_ids: Array.isArray(fw.style_direction_ids)
|
||||
? fw.style_direction_ids.map((x) => String(x))
|
||||
: fw.style_direction_id != null
|
||||
? [String(fw.style_direction_id)]
|
||||
: [],
|
||||
training_type_ids: Array.isArray(fw.training_type_ids)
|
||||
? fw.training_type_ids.map((x) => String(x))
|
||||
: [],
|
||||
target_group_ids: Array.isArray(fw.target_group_ids)
|
||||
? fw.target_group_ids.map((x) => String(x))
|
||||
: [],
|
||||
planned_period_start: fw.planned_period_start || '',
|
||||
planned_period_end: fw.planned_period_end || '',
|
||||
visibility: fw.visibility || 'private',
|
||||
club_id: fw.club_id != null ? String(fw.club_id) : '',
|
||||
goals: goalsIn.map((g) => ({
|
||||
@@ -142,6 +145,10 @@ function serverFrameworkToForm(fw) {
|
||||
slots: (fw.slots || []).map((s) => ({
|
||||
title: s.title || '',
|
||||
notes: s.notes || '',
|
||||
planned_duration_min:
|
||||
s.planned_duration_min != null && s.planned_duration_min !== undefined
|
||||
? String(s.planned_duration_min)
|
||||
: '',
|
||||
sections: normalizeUnitToForm({
|
||||
sections: s.sections,
|
||||
exercises: s.exercises,
|
||||
@@ -170,6 +177,7 @@ function buildApiPayload(form) {
|
||||
sort_order: si,
|
||||
title: (s.title || '').trim() || null,
|
||||
notes: (s.notes || '').trim() || null,
|
||||
planned_duration_min: parseDurationInput(s.planned_duration_min),
|
||||
}
|
||||
if (plan.phases) {
|
||||
return { ...base, phases: plan.phases }
|
||||
@@ -177,14 +185,12 @@ function buildApiPayload(form) {
|
||||
return { ...base, sections: plan.sections }
|
||||
})
|
||||
|
||||
const focusAreaId =
|
||||
form.focus_area_id && !Number.isNaN(parseInt(form.focus_area_id, 10))
|
||||
? parseInt(form.focus_area_id, 10)
|
||||
: null
|
||||
const styleDirectionId =
|
||||
form.style_direction_id && !Number.isNaN(parseInt(form.style_direction_id, 10))
|
||||
? parseInt(form.style_direction_id, 10)
|
||||
: null
|
||||
const focus_area_ids = (form.focus_area_ids || [])
|
||||
.map((x) => parseInt(String(x), 10))
|
||||
.filter((n) => !Number.isNaN(n) && n > 0)
|
||||
const style_direction_ids = (form.style_direction_ids || [])
|
||||
.map((x) => parseInt(String(x), 10))
|
||||
.filter((n) => !Number.isNaN(n) && n > 0)
|
||||
|
||||
const training_type_ids = (form.training_type_ids || [])
|
||||
.map((x) => parseInt(String(x), 10))
|
||||
@@ -201,12 +207,10 @@ function buildApiPayload(form) {
|
||||
return {
|
||||
title: (form.title || '').trim(),
|
||||
description: (form.description || '').trim() || null,
|
||||
focus_area_id: focusAreaId,
|
||||
style_direction_id: styleDirectionId,
|
||||
focus_area_ids,
|
||||
style_direction_ids,
|
||||
training_type_ids,
|
||||
target_group_ids,
|
||||
planned_period_start: form.planned_period_start || null,
|
||||
planned_period_end: form.planned_period_end || null,
|
||||
visibility: form.visibility || 'private',
|
||||
club_id: clubId,
|
||||
goals,
|
||||
@@ -544,14 +548,15 @@ export default function TrainingFrameworkProgramEditPage() {
|
||||
desktopLayout ? undefined : { display: panelActive(key) ? 'block' : 'none' }
|
||||
|
||||
const trainingTypesFiltered = useMemo(() => {
|
||||
if (!form.focus_area_id) return trainingTypesCatalog
|
||||
const faSet = new Set((form.focus_area_ids || []).map(String))
|
||||
if (!faSet.size) return trainingTypesCatalog
|
||||
return trainingTypesCatalog.filter(
|
||||
(t) => !t.focus_area_id || String(t.focus_area_id) === String(form.focus_area_id)
|
||||
(t) => !t.focus_area_id || faSet.has(String(t.focus_area_id))
|
||||
)
|
||||
}, [trainingTypesCatalog, form.focus_area_id])
|
||||
}, [trainingTypesCatalog, form.focus_area_ids])
|
||||
|
||||
useEffect(() => {
|
||||
if (!form.focus_area_id || trainingTypesCatalog.length === 0) return
|
||||
if (!(form.focus_area_ids || []).length || trainingTypesCatalog.length === 0) return
|
||||
const allowed = new Set(trainingTypesFiltered.map((t) => String(t.id)))
|
||||
setForm((prev) => {
|
||||
const cur = prev.training_type_ids || []
|
||||
@@ -559,7 +564,27 @@ export default function TrainingFrameworkProgramEditPage() {
|
||||
if (next.length === cur.length) return prev
|
||||
return { ...prev, training_type_ids: next }
|
||||
})
|
||||
}, [form.focus_area_id, trainingTypesCatalog.length, trainingTypesFiltered])
|
||||
}, [form.focus_area_ids, trainingTypesCatalog.length, trainingTypesFiltered])
|
||||
|
||||
const toggleFocusAreaId = (fid) => {
|
||||
const idStr = String(fid)
|
||||
setForm((prev) => {
|
||||
const s = new Set(prev.focus_area_ids || [])
|
||||
if (s.has(idStr)) s.delete(idStr)
|
||||
else s.add(idStr)
|
||||
return { ...prev, focus_area_ids: [...s].sort((a, b) => Number(a) - Number(b)) }
|
||||
})
|
||||
}
|
||||
|
||||
const toggleStyleDirectionId = (sid) => {
|
||||
const idStr = String(sid)
|
||||
setForm((prev) => {
|
||||
const s = new Set(prev.style_direction_ids || [])
|
||||
if (s.has(idStr)) s.delete(idStr)
|
||||
else s.add(idStr)
|
||||
return { ...prev, style_direction_ids: [...s].sort((a, b) => Number(a) - Number(b)) }
|
||||
})
|
||||
}
|
||||
|
||||
const toggleTrainingTypeId = (tid) => {
|
||||
const idStr = String(tid)
|
||||
@@ -786,6 +811,20 @@ export default function TrainingFrameworkProgramEditPage() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="form-row" style={{ marginTop: '0.5rem', maxWidth: '220px' }}>
|
||||
<label className="form-label" style={{ fontSize: '0.82rem' }}>
|
||||
Geplante Session-Dauer
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
className="form-input"
|
||||
inputMode="decimal"
|
||||
value={slot.planned_duration_min ?? ''}
|
||||
onChange={(e) => slotField(si, 'planned_duration_min', e.target.value)}
|
||||
placeholder="z. B. 1,5 h"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<details className="framework-slot-details">
|
||||
<summary className="framework-slot-details__summary">Notizen (Session)</summary>
|
||||
<div className="form-row">
|
||||
@@ -910,35 +949,47 @@ export default function TrainingFrameworkProgramEditPage() {
|
||||
/>
|
||||
</div>
|
||||
<div className="form-row">
|
||||
<label className="form-label">Fokusbereich (optional)</label>
|
||||
<select
|
||||
className="form-input"
|
||||
value={form.focus_area_id}
|
||||
onChange={(e) => updateField('focus_area_id', e.target.value)}
|
||||
>
|
||||
<option value="">— keiner —</option>
|
||||
{focusAreas.map((fa) => (
|
||||
<option key={fa.id} value={String(fa.id)}>
|
||||
{fa.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<p className="form-sub">Hilft beim Filtern der Trainingsarten und bei der späteren Zuordnung in der Planung.</p>
|
||||
<label className="form-label">Fokusbereiche (optional, Mehrfachwahl)</label>
|
||||
<div className="framework-catalog-checkgrid">
|
||||
{focusAreas.length === 0 ? (
|
||||
<p className="form-sub" style={{ marginTop: 0 }}>
|
||||
Keine Fokusbereiche im Katalog.
|
||||
</p>
|
||||
) : (
|
||||
focusAreas.map((fa) => (
|
||||
<label key={fa.id} className="framework-catalog-check">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={(form.focus_area_ids || []).includes(String(fa.id))}
|
||||
onChange={() => toggleFocusAreaId(fa.id)}
|
||||
/>
|
||||
<span>{fa.name}</span>
|
||||
</label>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
<p className="form-sub">Aus dem Katalog; filtert die Trainingsarten unten.</p>
|
||||
</div>
|
||||
<div className="form-row">
|
||||
<label className="form-label">Stilrichtung (optional)</label>
|
||||
<select
|
||||
className="form-input"
|
||||
value={form.style_direction_id}
|
||||
onChange={(e) => updateField('style_direction_id', e.target.value)}
|
||||
>
|
||||
<option value="">— keine —</option>
|
||||
{styleDirections.map((sd) => (
|
||||
<option key={sd.id} value={String(sd.id)}>
|
||||
{sd.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<label className="form-label">Stilrichtungen (optional, Mehrfachwahl)</label>
|
||||
<div className="framework-catalog-checkgrid">
|
||||
{styleDirections.length === 0 ? (
|
||||
<p className="form-sub" style={{ marginTop: 0 }}>
|
||||
Keine Stilrichtungen im Katalog.
|
||||
</p>
|
||||
) : (
|
||||
styleDirections.map((sd) => (
|
||||
<label key={sd.id} className="framework-catalog-check">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={(form.style_direction_ids || []).includes(String(sd.id))}
|
||||
onChange={() => toggleStyleDirectionId(sd.id)}
|
||||
/>
|
||||
<span>{sd.name}</span>
|
||||
</label>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="form-row">
|
||||
<label className="form-label">Trainingsarten (optional, Mehrfachwahl)</label>
|
||||
@@ -983,27 +1034,6 @@ export default function TrainingFrameworkProgramEditPage() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="responsive-grid-2" style={{ marginBottom: '16px' }}>
|
||||
<div>
|
||||
<label className="form-label">Zeitraum von</label>
|
||||
<input
|
||||
type="date"
|
||||
className="form-input"
|
||||
value={form.planned_period_start}
|
||||
onChange={(e) => updateField('planned_period_start', e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="form-label">Zeitraum bis</label>
|
||||
<input
|
||||
type="date"
|
||||
className="form-input"
|
||||
value={form.planned_period_end}
|
||||
onChange={(e) => updateField('planned_period_end', e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="responsive-grid-2" style={{ marginBottom: '16px' }}>
|
||||
<div>
|
||||
<label className="form-label">Sichtbarkeit</label>
|
||||
|
||||
@@ -15,8 +15,18 @@ function FrameworkSummaryMeta({ r }) {
|
||||
typeof r.training_type_names_agg === 'string' ? r.training_type_names_agg.trim() : ''
|
||||
const targetGroups =
|
||||
typeof r.target_group_names_agg === 'string' ? r.target_group_names_agg.trim() : ''
|
||||
const styleDir = typeof r.style_direction_name === 'string' ? r.style_direction_name.trim() : ''
|
||||
const focus = typeof r.focus_area_name === 'string' ? r.focus_area_name.trim() : ''
|
||||
const styleDir =
|
||||
typeof r.style_direction_names_agg === 'string'
|
||||
? r.style_direction_names_agg.trim()
|
||||
: typeof r.style_direction_name === 'string'
|
||||
? r.style_direction_name.trim()
|
||||
: ''
|
||||
const focus =
|
||||
typeof r.focus_area_names_agg === 'string'
|
||||
? r.focus_area_names_agg.trim()
|
||||
: typeof r.focus_area_name === 'string'
|
||||
? r.focus_area_name.trim()
|
||||
: ''
|
||||
|
||||
const rowStyle = {
|
||||
display: 'grid',
|
||||
@@ -33,12 +43,10 @@ function FrameworkSummaryMeta({ r }) {
|
||||
<dt style={{ margin: 0, fontWeight: 600, color: 'var(--text3)' }}>Fokusbereich</dt>
|
||||
<dd style={{ margin: 0 }}>{dashIfEmpty(focus)}</dd>
|
||||
</div>
|
||||
{styleDir ? (
|
||||
<div style={rowStyle}>
|
||||
<dt style={{ margin: 0, fontWeight: 600, color: 'var(--text3)' }}>Stilrichtung</dt>
|
||||
<dd style={{ margin: 0 }}>{styleDir}</dd>
|
||||
</div>
|
||||
) : null}
|
||||
<div style={rowStyle}>
|
||||
<dt style={{ margin: 0, fontWeight: 600, color: 'var(--text3)' }}>Stilrichtungen</dt>
|
||||
<dd style={{ margin: 0 }}>{dashIfEmpty(styleDir)}</dd>
|
||||
</div>
|
||||
<div style={rowStyle}>
|
||||
<dt style={{ margin: 0, fontWeight: 600, color: 'var(--text3)' }}>Trainingsarten</dt>
|
||||
<dd style={{ margin: 0 }}>{trainingTypes.length ? trainingTypes : '—'}</dd>
|
||||
|
||||
Reference in new issue
Block a user