Dedup Garmin data storage, configurable chart colors, taxonomy fixes, sync/progression fixes
- Remove duplicated Garmin fields from storage; decode display-only fields (activity name/type, lap duration/HR, structured workout raw JSON) from RawJSON at API-response time instead of storing redundant columns - Add a fully configurable chart color system (pace/HR main-line colors, 4 effort-kind colors, tint/darken/brighten intensity knobs) under Profile > Chart colors - Rename training types and fix their display order (Easy, Long, 60'/30' Threshold, Tempo, Intervals, MAS Test, Race) everywhere they're listed - Add an Efficiency Factor progression metric; fix Progression chart axes to use tight non-zero-based domains, m:ss/km pace formatting, and rounded ticks instead of raw floating-point labels - Expose the raw get_workout_by_id() payload in the raw-data viewer alongside activity/lap/detail JSON; enlarge the modal and shrink array indentation for readability - Fix "last sync" reporting a meaningless activity count: record one combined sync run per manual "Sync now" and count genuinely new activities instead of re-listing whatever Garmin returned for the queried window - Let a Review Queue activity be manually cleared back to Unclassified, and make "Reset all" available even while disconnected from Garmin Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -244,10 +244,23 @@ func (c *mcpClient) GetActivitySplits(ctx context.Context, activityID int64) (Ac
|
||||
return ActivitySplits{}, err
|
||||
}
|
||||
|
||||
var splits ActivitySplits
|
||||
if err := json.Unmarshal([]byte(msg), &splits); err != nil {
|
||||
var envelope struct {
|
||||
ActivityID int64 `json:"activityId"`
|
||||
Laps []json.RawMessage `json:"lapDTOs"`
|
||||
}
|
||||
if err := json.Unmarshal([]byte(msg), &envelope); err != nil {
|
||||
return ActivitySplits{}, fmt.Errorf("get_activity_splits did not return valid JSON (%q): %w", truncate(msg, 200), err)
|
||||
}
|
||||
|
||||
splits := ActivitySplits{ActivityID: envelope.ActivityID, Laps: make([]Lap, 0, len(envelope.Laps))}
|
||||
for _, raw := range envelope.Laps {
|
||||
var l Lap
|
||||
if err := json.Unmarshal(raw, &l); err != nil {
|
||||
return ActivitySplits{}, fmt.Errorf("parse lap: %w", err)
|
||||
}
|
||||
l.Raw = raw
|
||||
splits.Laps = append(splits.Laps, l)
|
||||
}
|
||||
return splits, nil
|
||||
}
|
||||
|
||||
@@ -269,6 +282,7 @@ func (c *mcpClient) GetActivityDetails(ctx context.Context, activityID int64) (A
|
||||
if err := json.Unmarshal([]byte(msg), &details); err != nil {
|
||||
return ActivityDetails{}, fmt.Errorf("get_activity_details did not return valid JSON (%q): %w", truncate(msg, 200), err)
|
||||
}
|
||||
details.Raw = json.RawMessage(msg)
|
||||
return details, nil
|
||||
}
|
||||
|
||||
@@ -290,6 +304,7 @@ func (c *mcpClient) GetWorkoutByID(ctx context.Context, workoutID int64) (Workou
|
||||
if err := json.Unmarshal([]byte(msg), &workout); err != nil {
|
||||
return Workout{}, fmt.Errorf("get_workout_by_id did not return valid JSON (%q): %w", truncate(msg, 200), err)
|
||||
}
|
||||
workout.Raw = json.RawMessage(msg)
|
||||
return workout, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user