feat: enhance training unit update functionality and improve UI controls
- Added logic to retrieve existing trainer notes if not provided during the update of training units. - Updated the TrainingCoachPage to include new controls for managing training sessions, including timer functionalities and navigation enhancements. - Improved user experience with clearer button labels and conditional rendering based on the training session state.
This commit is contained in:
1 parent
6fd316e985
commit
0dfc08459e
2 files changed
+312
-58
No files matched your search
@@ -679,6 +679,17 @@ def update_training_unit(unit_id: int, data: dict, session=Depends(require_auth)
|
||||
_template_access(cur, tid, profile_id, role)
|
||||
tpl_id_val = tid
|
||||
|
||||
trainer_notes_val = None
|
||||
if "trainer_notes" not in data:
|
||||
cur.execute(
|
||||
"SELECT trainer_notes FROM training_units WHERE id = %s",
|
||||
(unit_id,),
|
||||
)
|
||||
row_tn = cur.fetchone()
|
||||
trainer_notes_val = row_tn["trainer_notes"] if row_tn else None
|
||||
else:
|
||||
trainer_notes_val = data.get("trainer_notes")
|
||||
|
||||
cur.execute(
|
||||
"""
|
||||
UPDATE training_units SET
|
||||
@@ -708,7 +719,7 @@ def update_training_unit(unit_id: int, data: dict, session=Depends(require_auth)
|
||||
data.get("attendance_count"),
|
||||
data.get("status"),
|
||||
data.get("notes"),
|
||||
data.get("trainer_notes"),
|
||||
trainer_notes_val,
|
||||
tpl_id_val,
|
||||
unit_id,
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user