feat: Enhance goal progress tracking and display
- Added a function to calculate goal progress percentage based on start, target, and current values. - Updated GoalsPage to display progress in a user-friendly format, including visual progress bars. - Implemented error handling for goal progress updates in the backend to ensure robustness.
This commit is contained in:
1 parent
df8e732709
commit
1b01f5e6d0
2 files changed
+61
-12
No files matched your search
@@ -699,6 +699,12 @@ def get_goals_grouped(session: dict = Depends(require_auth)):
|
||||
grouped[cat] = []
|
||||
|
||||
goal_dict = r2d(goal)
|
||||
# Keep in sync with GET /goals/list: derive current_value & progress from live data
|
||||
try:
|
||||
_update_goal_progress(conn, pid, goal_dict)
|
||||
except Exception as e:
|
||||
print(f"[ERROR] Failed to update progress for goal {goal_dict.get('id')}: {e}")
|
||||
|
||||
goal_dict['focus_contributions'] = focus_map.get(goal['id'], [])
|
||||
grouped[cat].append(goal_dict)
|
||||
|
||||
|
||||
Reference in new issue
Block a user