feat: enhance training framework programs and planning features
Deploy Development / deploy (push) Successful in 41s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Failing after 40s

- Added aggregation of training type names and target group names in the training framework programs API response for improved data presentation.
- Implemented origin framework slot tracking in the training planning module, allowing users to import training units from framework programs.
- Enhanced the TrainingFrameworkProgramsListPage to display aggregated training type and target group information, improving user experience.
- Introduced a modal for importing framework programs into training planning, streamlining the process of managing training units.
This commit is contained in:
Lars committed 2026-05-05 15:03:54 +02:00
1 parent 86192df508
commit 6dcbc8c610
4 files changed
+499 -29

No files matched your search

+13 -1
View File
@@ -295,7 +295,19 @@ def list_training_framework_programs(session=Depends(require_auth)):
(SELECT COUNT(*)::int FROM training_framework_program_training_types t
WHERE t.framework_program_id = fp.id) AS training_types_count,
(SELECT COUNT(*)::int FROM training_framework_program_target_groups tg
WHERE tg.framework_program_id = fp.id) AS target_groups_count
WHERE tg.framework_program_id = fp.id) AS target_groups_count,
(
SELECT STRING_AGG(typ.name::text, ', ' ORDER BY typ.sort_order NULLS LAST, typ.name)
FROM training_framework_program_training_types j
JOIN training_types typ ON typ.id = j.training_type_id
WHERE j.framework_program_id = fp.id
) AS training_type_names_agg,
(
SELECT STRING_AGG(tg.name::text, ', ' ORDER BY tg.name)
FROM training_framework_program_target_groups j
JOIN target_groups tg ON tg.id = j.target_group_id
WHERE j.framework_program_id = fp.id
) AS target_group_names_agg
FROM training_framework_programs fp
LEFT JOIN focus_areas fa ON fa.id = fp.focus_area_id
LEFT JOIN style_directions sd ON sd.id = fp.style_direction_id
+20 -2
View File
@@ -112,6 +112,19 @@ def _assert_delete_training_unit(role: str, created_by: int, profile_id: int) ->
raise HTTPException(status_code=403, detail="Keine Berechtigung")
# Nachverfolgbarkeit: Übernahmen aus Rahmenprogramm über origin_framework_slot_id
_ORIGIN_LINEAGE_JOIN = """
LEFT JOIN training_framework_slots origin_slot ON origin_slot.id = tu.origin_framework_slot_id
LEFT JOIN training_framework_programs origin_fp ON origin_fp.id = origin_slot.framework_program_id
"""
_ORIGIN_LINEAGE_FIELDS = """
origin_fp.id AS origin_framework_program_id,
origin_fp.title AS origin_framework_program_title,
COALESCE(TRIM(origin_slot.title), '') AS origin_framework_slot_title,
origin_slot.sort_order AS origin_framework_slot_sort_order
"""
def _fetch_sections(cur, unit_id: int) -> List[Dict[str, Any]]:
cur.execute(
"""
@@ -636,12 +649,15 @@ def list_training_units(
tg.name as group_name,
tg.weekday as group_weekday,
c.name as club_name,
p.name as trainer_name
p.name as trainer_name"""
query += "," + _ORIGIN_LINEAGE_FIELDS
query += """
FROM training_units tu
LEFT JOIN training_groups tg ON tu.group_id = tg.id
LEFT JOIN clubs c ON tg.club_id = c.id
LEFT JOIN profiles p ON tu.created_by = p.id
"""
query += _ORIGIN_LINEAGE_JOIN
where = []
params = []
@@ -695,11 +711,13 @@ def get_training_unit(unit_id: int, session=Depends(require_auth)):
tg.time_end as group_time_end,
tg.location as group_location,
c.name as club_name,
p.name as trainer_name
p.name as trainer_name,
""" + _ORIGIN_LINEAGE_FIELDS.strip() + """
FROM training_units tu
LEFT JOIN training_groups tg ON tu.group_id = tg.id
LEFT JOIN clubs c ON tg.club_id = c.id
LEFT JOIN profiles p ON tu.created_by = p.id
""" + _ORIGIN_LINEAGE_JOIN.strip() + """
WHERE tu.id = %s
""",
(unit_id,),