Add segments, YTD stats, route matching fixes, body battery layout, pace fix
- Segments page: new /segments route with auto-generate (1km splits, turn detection, hill detection), manual segment creation, per-segment performance times across matched activities; fixed auth on existing segment endpoints - YTD distance: new /activities/stats/ytd endpoint; Dashboard replaces 'Total distance' with 'Running this year' + 'Cycling this year'; Activities page shows YTD stats row - Weekly chart click: clicking a Dashboard bar navigates to Activities filtered to that week; Activities reads from/to query params with dismissable chip - Route matching: add ±2.5% distance gate + 3% relative DTW threshold (was flat 80m); tighten candidate pre-filter from 80/120% to 95/105% - Body battery layout: HR chart and body battery now side-by-side at same height on large screens instead of stacked full-width - Pace display fix: MetricTimeline clamps GPS speed outliers before computing Y-axis domain; tick formatter guards against v<=0 or v>25 m/s Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -314,6 +314,7 @@ def detect_route(activity_id: int, user_id: int):
|
||||
if route.reference_polyline and routes_are_similar(
|
||||
new_act.polyline, route.reference_polyline,
|
||||
new_act.bounding_box, route.bounding_box,
|
||||
dist1=new_act.distance_m, dist2=route.distance_m,
|
||||
):
|
||||
new_act.named_route_id = route.id
|
||||
db.commit()
|
||||
@@ -326,8 +327,8 @@ def detect_route(activity_id: int, user_id: int):
|
||||
Activity.named_route_id == None,
|
||||
Activity.id != activity_id,
|
||||
Activity.polyline != None,
|
||||
Activity.distance_m >= (new_act.distance_m or 0) * 0.8,
|
||||
Activity.distance_m <= (new_act.distance_m or 0) * 1.2,
|
||||
Activity.distance_m >= (new_act.distance_m or 0) * 0.95,
|
||||
Activity.distance_m <= (new_act.distance_m or 0) * 1.05,
|
||||
)
|
||||
).scalars().all()
|
||||
|
||||
@@ -335,6 +336,7 @@ def detect_route(activity_id: int, user_id: int):
|
||||
if routes_are_similar(
|
||||
new_act.polyline, candidate.polyline,
|
||||
new_act.bounding_box, candidate.bounding_box,
|
||||
dist1=new_act.distance_m, dist2=candidate.distance_m,
|
||||
):
|
||||
older = candidate if candidate.start_time < new_act.start_time else new_act
|
||||
newer = new_act if candidate.start_time < new_act.start_time else candidate
|
||||
|
||||
Reference in New Issue
Block a user