Commit Graph

4 Commits

Author SHA1 Message Date
285184ba89 fix: add missing statistics import and update focus_weights function
All checks were successful
Deploy Development / deploy (push) Successful in 50s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 14s
Two critical fixes for placeholder resolution:

1. Missing import in activity_metrics.py:
   - Added 'import statistics' at module level
   - Fixes calculate_monotony_score() and calculate_strain_score()
   - Error: NameError: name 'statistics' is not defined

2. Outdated focus_weights function in body_metrics.py:
   - Changed from goal_utils.get_focus_weights (uses old focus_areas table)
   - To data_layer.scores.get_user_focus_weights (uses new v2.0 system)
   - Fixes calculate_body_progress_score()
   - Error: UndefinedTable: relation "focus_areas" does not exist

These were causing many placeholders to fail silently.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 20:46:21 +01:00
5b7d7ec3bb fix: Phase 0c - update all in-function imports to use data_layer
All checks were successful
Deploy Development / deploy (push) Successful in 44s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 14s
Critical bug fix: In-function imports were still referencing calculations/ module.
This caused all calculated placeholders to fail silently.

Fixed imports in:
- activity_metrics.py: calculate_activity_score (scores import)
- recovery_metrics.py: calculate_recent_load_balance_3d (activity_metrics import)
- scores.py: 12 function imports (body/nutrition/activity/recovery metrics)
- correlations.py: 11 function imports (scores, body, nutrition, activity, recovery metrics)

All data_layer modules now reference each other correctly.
Placeholders should resolve properly now.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 20:36:50 +01:00
dc34d3d2f2 feat: Phase 0c - migrate activity_metrics calculations to data_layer (20 functions)
All checks were successful
Deploy Development / deploy (push) Successful in 44s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 14s
- Migrated all 20 calculation functions from calculations/activity_metrics.py to data_layer/activity_metrics.py
- Functions: Training volume (minutes/week, frequency, quality sessions %)
- Functions: Intensity distribution (proxy-based until HR zones available)
- Functions: Ability balance (strength, endurance, mental, coordination, mobility)
- Functions: Load monitoring (internal load proxy, monotony score, strain score)
- Functions: Activity scoring (main score with focus weights, strength/cardio/balance helpers)
- Functions: Rest day compliance
- Functions: VO2max trend (28d)
- Functions: Data quality assessment
- Updated data_layer/__init__.py with 17 new exports
- Refactored placeholder_resolver.py to import activity_metrics from data_layer

Module 3/6 complete. Single Source of Truth for activity metrics established.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 20:18:49 +01:00
6b2ad9fa1c feat: Phase 0c - activity_metrics.py module complete
All checks were successful
Deploy Development / deploy (push) Successful in 51s
Build Test / lint-backend (push) Successful in 1s
Build Test / build-frontend (push) Successful in 16s
Data Layer:
- get_activity_summary_data() - count, duration, calories, frequency
- get_activity_detail_data() - detailed activity log with all fields
- get_training_type_distribution_data() - category distribution with percentages

Placeholder Layer:
- get_activity_summary() - refactored to use data layer
- get_activity_detail() - refactored to use data layer
- get_trainingstyp_verteilung() - refactored to use data layer

All 3 activity data functions + 3 placeholder refactors complete.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 19:11:45 +01:00