feat: Enhance activity import functionality with additional metrics
- 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:
1 parent
5cda485458
commit
7d6fdab812
4 files changed
+109
-48
No files matched your search
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user