Enhance Training Framework Programs with Session Duration and Filtering Features
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Successful in 39s
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 1m29s
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Successful in 39s
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 1m29s
- Added SQL aggregations for session duration (min/max) and goal titles in the training framework programs query. - Updated the TrainingPlanningFrameworkImportModal component to include filtering options for focus areas, training types, and target groups. - Implemented session duration display in the TrainingFrameworkProgramsListPage, improving user visibility of program details. - Introduced utility functions for formatting session duration ranges, enhancing the overall user experience in training planning.
This commit is contained in:
1 parent
5a8a212f40
commit
9353909fda
7 files changed
+450
-14
No files matched your search
@@ -31,6 +31,7 @@ import {
|
||||
legacyPlanningUnitDeepLinkTarget,
|
||||
parsePlanningHubQuery,
|
||||
} from '../../utils/planningUnitRoutes'
|
||||
import { formatDurationDisplay } from '../../utils/trainingDurationUtils'
|
||||
|
||||
function TrainingPlanningPageRoot() {
|
||||
const { user } = useAuth()
|
||||
@@ -55,6 +56,9 @@ function TrainingPlanningPageRoot() {
|
||||
|
||||
const [frameworkImportOpen, setFrameworkImportOpen] = useState(false)
|
||||
const [frameworkProgramsList, setFrameworkProgramsList] = useState([])
|
||||
const [fwImportCatalogFocus, setFwImportCatalogFocus] = useState([])
|
||||
const [fwImportCatalogTypes, setFwImportCatalogTypes] = useState([])
|
||||
const [fwImportCatalogTargetGroups, setFwImportCatalogTargetGroups] = useState([])
|
||||
const [fwImportProgramId, setFwImportProgramId] = useState('')
|
||||
const [fwImportDetail, setFwImportDetail] = useState(null)
|
||||
const [fwImportLoading, setFwImportLoading] = useState(false)
|
||||
@@ -271,12 +275,25 @@ function TrainingPlanningPageRoot() {
|
||||
let cancelled = false
|
||||
;(async () => {
|
||||
try {
|
||||
const list = await api.listTrainingFrameworkPrograms()
|
||||
if (!cancelled) setFrameworkProgramsList(Array.isArray(list) ? list : [])
|
||||
const [list, fa, tt, tg] = await Promise.all([
|
||||
api.listTrainingFrameworkPrograms(),
|
||||
api.listFocusAreas({ status: 'active' }),
|
||||
api.listTrainingTypes({ status: 'active' }),
|
||||
api.listTargetGroups({ status: 'active' }),
|
||||
])
|
||||
if (!cancelled) {
|
||||
setFrameworkProgramsList(Array.isArray(list) ? list : [])
|
||||
setFwImportCatalogFocus(Array.isArray(fa) ? fa : [])
|
||||
setFwImportCatalogTypes(Array.isArray(tt) ? tt : [])
|
||||
setFwImportCatalogTargetGroups(Array.isArray(tg) ? tg : [])
|
||||
}
|
||||
} catch (e) {
|
||||
if (!cancelled) {
|
||||
console.error('Rahmenprogramme laden:', e)
|
||||
setFrameworkProgramsList([])
|
||||
setFwImportCatalogFocus([])
|
||||
setFwImportCatalogTypes([])
|
||||
setFwImportCatalogTargetGroups([])
|
||||
}
|
||||
}
|
||||
})()
|
||||
@@ -1033,7 +1050,9 @@ function TrainingPlanningPageRoot() {
|
||||
onClick={() => handleEdit(unit)}
|
||||
title={[
|
||||
planScope === 'club' && unit.group_name ? unit.group_name : '',
|
||||
unit.planned_time_start?.slice(0, 5) || '',
|
||||
unit.planned_duration_min
|
||||
? formatDurationDisplay(unit.planned_duration_min)
|
||||
: unit.planned_time_start?.slice(0, 5) || '',
|
||||
unit.lead_trainer_name?.trim(),
|
||||
unit.planned_focus?.trim(),
|
||||
unit.status === 'completed'
|
||||
@@ -1066,9 +1085,11 @@ function TrainingPlanningPageRoot() {
|
||||
}}
|
||||
>
|
||||
<span style={{ fontWeight: 600 }}>
|
||||
{unit.planned_time_start
|
||||
? `${unit.planned_time_start.slice(0, 5)}`
|
||||
: 'Ganztags'}
|
||||
{unit.planned_duration_min
|
||||
? formatDurationDisplay(unit.planned_duration_min)
|
||||
: unit.planned_time_start
|
||||
? `${unit.planned_time_start.slice(0, 5)}`
|
||||
: 'Ganztags'}
|
||||
</span>
|
||||
{planScope === 'club' && (unit.group_name || '').trim() ? (
|
||||
<span style={{ display: 'block', fontWeight: 500, color: 'var(--text1)' }}>
|
||||
@@ -1158,11 +1179,17 @@ function TrainingPlanningPageRoot() {
|
||||
<h3 style={{ marginBottom: '0.25rem' }}>
|
||||
{unit.planned_date}
|
||||
{unit.planned_duration_min
|
||||
? ` · ${unit.planned_duration_min >= 60 && unit.planned_duration_min % 60 === 0 ? `${unit.planned_duration_min / 60} h` : `${unit.planned_duration_min} Min`}`
|
||||
? ` · ${formatDurationDisplay(unit.planned_duration_min)}`
|
||||
: unit.planned_time_start
|
||||
? ` · ${unit.planned_time_start.slice(0, 5)} - ${unit.planned_time_end?.slice(0, 5)}`
|
||||
? ` · ${unit.planned_time_start.slice(0, 5)}${unit.planned_time_end ? ` – ${unit.planned_time_end.slice(0, 5)}` : ''}`
|
||||
: ''}
|
||||
</h3>
|
||||
{unit.planned_duration_min && unit.planned_time_start ? (
|
||||
<p style={{ fontSize: '0.78rem', color: 'var(--text3)', margin: '0 0 0.35rem' }}>
|
||||
Uhrzeit: {unit.planned_time_start.slice(0, 5)}
|
||||
{unit.planned_time_end ? ` – ${unit.planned_time_end.slice(0, 5)}` : ''}
|
||||
</p>
|
||||
) : null}
|
||||
{planScope === 'club' && (unit.group_name || '').trim() ? (
|
||||
<p
|
||||
style={{
|
||||
@@ -1378,6 +1405,9 @@ function TrainingPlanningPageRoot() {
|
||||
<TrainingPlanningFrameworkImportModal
|
||||
open={frameworkImportOpen}
|
||||
frameworkProgramsList={frameworkProgramsList}
|
||||
catalogFocusAreas={fwImportCatalogFocus}
|
||||
catalogTrainingTypes={fwImportCatalogTypes}
|
||||
catalogTargetGroups={fwImportCatalogTargetGroups}
|
||||
fwImportProgramId={fwImportProgramId}
|
||||
onProgramChange={onFwImportProgramChange}
|
||||
fwImportLoading={fwImportLoading}
|
||||
|
||||
Reference in new issue
Block a user