feat: Enhance activity import functionality with additional metrics
Deploy Development / deploy (push) Successful in 58s
Build Test / pytest-backend (push) Successful in 4s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 17s

- Updated the `_import_activity` function to include new metrics: duration_min, kcal_active, kcal_resting, hr_avg, hr_max, and distance_km during CSV imports.
- Modified the `insert_activity_csv_minimal` function to accept and store these additional metrics in the activity log.
- Enhanced the `run_activity_post_write_hooks_import` function to utilize the new metrics for auto-evaluation after activity imports.
- Updated the activity import router to pass the new metrics from the CSV file to the database functions, ensuring comprehensive data handling.
- Improved frontend handling of activity entry forms to accommodate the new metrics, enhancing user experience during activity log edits.
This commit is contained in:
Lars committed 2026-04-16 11:04:43 +02:00
1 parent 5cda485458
commit 7d6fdab812
4 files changed
+109 -48

No files matched your search

+13
View File
@@ -899,6 +899,12 @@ def _import_activity(
start_time=workout_start_t,
end_time=end_str or None,
activity_type=wtype,
duration_min=registry_updates.get("duration_min"),
kcal_active=registry_updates.get("kcal_active"),
kcal_resting=registry_updates.get("kcal_resting"),
hr_avg=registry_updates.get("hr_avg"),
hr_max=registry_updates.get("hr_max"),
distance_km=registry_updates.get("distance_km"),
training_type_id=training_type_id,
training_category=training_category,
training_subcategory=training_subcategory,
@@ -915,7 +921,14 @@ def _import_activity(
cur,
profile_id,
str(aid),
workout_date=iso,
training_type_id=training_type_id,
duration_min=registry_updates.get("duration_min"),
hr_avg=registry_updates.get("hr_avg"),
hr_max=registry_updates.get("hr_max"),
distance_km=registry_updates.get("distance_km"),
kcal_active=registry_updates.get("kcal_active"),
kcal_resting=registry_updates.get("kcal_resting"),
)
upsert_session_metrics_from_csv_mapped(
cur,