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
@@ -648,6 +648,7 @@ def _ensure_default_whole_group_phase(cur, unit_id: int, *, order_index: int = 0
|
||||
|
||||
_SECTION_ROWS_SQL = """
|
||||
SELECT tus.id, tus.training_unit_id, tus.order_index, tus.title, tus.guidance_notes,
|
||||
tus.planned_duration_min,
|
||||
tus.source_template_section_id, tus.phase_id, tus.parallel_stream_id
|
||||
FROM training_unit_sections tus
|
||||
LEFT JOIN training_unit_phases ph ON ph.id = tus.phase_id
|
||||
@@ -740,7 +741,7 @@ def _fetch_phases_nested(cur, unit_id: int) -> List[Dict[str, Any]]:
|
||||
cur.execute(
|
||||
"""
|
||||
SELECT id, training_unit_id, order_index, title, guidance_notes,
|
||||
source_template_section_id, phase_id, parallel_stream_id
|
||||
planned_duration_min, source_template_section_id, phase_id, parallel_stream_id
|
||||
FROM training_unit_sections
|
||||
WHERE phase_id = %s
|
||||
ORDER BY order_index
|
||||
@@ -771,7 +772,7 @@ def _fetch_phases_nested(cur, unit_id: int) -> List[Dict[str, Any]]:
|
||||
cur.execute(
|
||||
"""
|
||||
SELECT id, training_unit_id, order_index, title, guidance_notes,
|
||||
source_template_section_id, phase_id, parallel_stream_id
|
||||
planned_duration_min, source_template_section_id, phase_id, parallel_stream_id
|
||||
FROM training_unit_sections
|
||||
WHERE parallel_stream_id = %s
|
||||
ORDER BY order_index
|
||||
@@ -831,6 +832,7 @@ def _clone_section_payload_dict(sec: Dict[str, Any]) -> Dict[str, Any]:
|
||||
"title": sec.get("title"),
|
||||
"order_index": sec.get("order_index"),
|
||||
"guidance_notes": sec.get("guidance_notes"),
|
||||
"planned_duration_min": sec.get("planned_duration_min"),
|
||||
"items": items_clean,
|
||||
}
|
||||
stid = sec.get("source_template_section_id")
|
||||
@@ -974,6 +976,7 @@ def _copy_blueprint_into_scheduled_unit(
|
||||
planned_date,
|
||||
planned_time_start,
|
||||
planned_time_end,
|
||||
planned_duration_min,
|
||||
planned_focus,
|
||||
actual_date,
|
||||
actual_time_start,
|
||||
@@ -992,6 +995,7 @@ def _copy_blueprint_into_scheduled_unit(
|
||||
%s,
|
||||
planned_time_start,
|
||||
planned_time_end,
|
||||
planned_duration_min,
|
||||
planned_focus,
|
||||
NULL::DATE,
|
||||
NULL::TIME WITHOUT TIME ZONE,
|
||||
@@ -1281,8 +1285,9 @@ def _insert_one_replacement_section(
|
||||
cur.execute(
|
||||
"""
|
||||
INSERT INTO training_unit_sections (
|
||||
training_unit_id, phase_id, parallel_stream_id, order_index, title, guidance_notes, source_template_section_id
|
||||
) VALUES (%s, %s, %s, %s, %s, %s, %s)
|
||||
training_unit_id, phase_id, parallel_stream_id, order_index, title, guidance_notes,
|
||||
planned_duration_min, source_template_section_id
|
||||
) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)
|
||||
RETURNING id
|
||||
""",
|
||||
(
|
||||
@@ -1292,6 +1297,7 @@ def _insert_one_replacement_section(
|
||||
order_ix,
|
||||
title,
|
||||
sec.get("guidance_notes"),
|
||||
sec.get("planned_duration_min"),
|
||||
src_tsec,
|
||||
),
|
||||
)
|
||||
@@ -1629,10 +1635,12 @@ def _normalize_training_plan_template_section_payload(sec: Any, si: int) -> Dict
|
||||
p_so = int(raw_so) if raw_so is not None and raw_so != "" else 0
|
||||
except (TypeError, ValueError):
|
||||
p_so = 0
|
||||
pdur = _optional_positive_int(sec.get("planned_duration_min"), "planned_duration_min")
|
||||
return {
|
||||
"title": title,
|
||||
"order_index": order_ix,
|
||||
"guidance_text": sec.get("guidance_text"),
|
||||
"planned_duration_min": pdur,
|
||||
"phase_kind": pk,
|
||||
"phase_order_index": p_oi,
|
||||
"parallel_stream_order_index": p_so,
|
||||
@@ -1645,15 +1653,16 @@ def _insert_training_plan_template_sections(cur, template_id: int, sections_in:
|
||||
cur.execute(
|
||||
"""
|
||||
INSERT INTO training_plan_template_sections (
|
||||
template_id, order_index, title, guidance_text,
|
||||
template_id, order_index, title, guidance_text, planned_duration_min,
|
||||
phase_kind, phase_order_index, parallel_stream_order_index
|
||||
) VALUES (%s, %s, %s, %s, %s, %s, %s)
|
||||
) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)
|
||||
""",
|
||||
(
|
||||
template_id,
|
||||
row["order_index"],
|
||||
row["title"],
|
||||
row["guidance_text"],
|
||||
row["planned_duration_min"],
|
||||
row["phase_kind"],
|
||||
row["phase_order_index"],
|
||||
row["parallel_stream_order_index"],
|
||||
@@ -1700,6 +1709,7 @@ def _template_rows_to_phases_payload(rows: List[Dict[str, Any]]) -> List[Dict[st
|
||||
"title": rr.get("title"),
|
||||
"order_index": j,
|
||||
"guidance_notes": rr.get("guidance_text"),
|
||||
"planned_duration_min": rr.get("planned_duration_min"),
|
||||
"items": [],
|
||||
**(
|
||||
{"source_template_section_id": int(tid)}
|
||||
@@ -1743,6 +1753,7 @@ def _template_rows_to_phases_payload(rows: List[Dict[str, Any]]) -> List[Dict[st
|
||||
"title": rr.get("title"),
|
||||
"order_index": j,
|
||||
"guidance_notes": rr.get("guidance_text"),
|
||||
"planned_duration_min": rr.get("planned_duration_min"),
|
||||
"items": [],
|
||||
**(
|
||||
{"source_template_section_id": int(tid)}
|
||||
@@ -1775,7 +1786,7 @@ def _instantiate_from_template(
|
||||
) -> None:
|
||||
cur.execute(
|
||||
"""
|
||||
SELECT id, title, guidance_text, order_index, phase_kind, phase_order_index, parallel_stream_order_index
|
||||
SELECT id, title, guidance_text, planned_duration_min, order_index, phase_kind, phase_order_index, parallel_stream_order_index
|
||||
FROM training_plan_template_sections
|
||||
WHERE template_id = %s
|
||||
ORDER BY order_index
|
||||
@@ -2591,11 +2602,13 @@ def create_training_unit(data: dict, tenant: TenantContext = Depends(get_tenant_
|
||||
eff_lead_for_co,
|
||||
)
|
||||
|
||||
pdur = _optional_positive_int(data.get("planned_duration_min"), "planned_duration_min")
|
||||
base_params = (
|
||||
group_id,
|
||||
planned_date,
|
||||
data.get("planned_time_start"),
|
||||
data.get("planned_time_end"),
|
||||
pdur,
|
||||
data.get("planned_focus"),
|
||||
data.get("status", "planned"),
|
||||
data.get("notes"),
|
||||
@@ -2610,11 +2623,11 @@ def create_training_unit(data: dict, tenant: TenantContext = Depends(get_tenant_
|
||||
"""
|
||||
INSERT INTO training_units (
|
||||
group_id, planned_date, planned_time_start, planned_time_end,
|
||||
planned_focus, status, notes, trainer_notes, created_by,
|
||||
planned_duration_min, planned_focus, status, notes, trainer_notes, created_by,
|
||||
plan_template_id,
|
||||
lead_trainer_profile_id,
|
||||
assistant_trainer_profile_ids
|
||||
) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
|
||||
) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
|
||||
RETURNING id
|
||||
""",
|
||||
base_params + (av_db,),
|
||||
@@ -2624,10 +2637,10 @@ def create_training_unit(data: dict, tenant: TenantContext = Depends(get_tenant_
|
||||
"""
|
||||
INSERT INTO training_units (
|
||||
group_id, planned_date, planned_time_start, planned_time_end,
|
||||
planned_focus, status, notes, trainer_notes, created_by,
|
||||
planned_duration_min, planned_focus, status, notes, trainer_notes, created_by,
|
||||
plan_template_id,
|
||||
lead_trainer_profile_id
|
||||
) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
|
||||
) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
|
||||
RETURNING id
|
||||
""",
|
||||
base_params,
|
||||
@@ -2717,6 +2730,11 @@ def update_training_unit(unit_id: int, data: dict, tenant: TenantContext = Depen
|
||||
if "planned_time_end" in data:
|
||||
blueprint_fields.append("planned_time_end = %s")
|
||||
blueprint_params.append(data.get("planned_time_end"))
|
||||
if "planned_duration_min" in data:
|
||||
blueprint_fields.append("planned_duration_min = %s")
|
||||
blueprint_params.append(
|
||||
_optional_positive_int(data.get("planned_duration_min"), "planned_duration_min")
|
||||
)
|
||||
if "notes" in data:
|
||||
blueprint_fields.append("notes = %s")
|
||||
blueprint_params.append(data.get("notes"))
|
||||
@@ -2782,6 +2800,7 @@ def update_training_unit(unit_id: int, data: dict, tenant: TenantContext = Depen
|
||||
planned_date = COALESCE(%s, planned_date),
|
||||
planned_time_start = %s,
|
||||
planned_time_end = %s,
|
||||
planned_duration_min = %s,
|
||||
planned_focus = %s,
|
||||
actual_date = %s,
|
||||
actual_time_start = %s,
|
||||
@@ -2801,6 +2820,9 @@ def update_training_unit(unit_id: int, data: dict, tenant: TenantContext = Depen
|
||||
data.get("planned_date"),
|
||||
data.get("planned_time_start"),
|
||||
data.get("planned_time_end"),
|
||||
_optional_positive_int(data.get("planned_duration_min"), "planned_duration_min")
|
||||
if "planned_duration_min" in data
|
||||
else unit_row.get("planned_duration_min"),
|
||||
data.get("planned_focus"),
|
||||
data.get("actual_date"),
|
||||
data.get("actual_time_start"),
|
||||
|
||||
Reference in new issue
Block a user