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:
2026-07-20 06:33:47 +02:00
parent 9818d35910
commit 518bccf5ab
56 changed files with 2334 additions and 890 deletions

View File

@@ -152,17 +152,17 @@ func seedActivity(ctx context.Context, db *store.DB, p seedParams) int64 {
anaerobic := p.anaerobicTE
id, err := db.UpsertActivity(ctx, store.Activity{
GarminActivityID: p.garminID,
ActivityName: p.name,
ActivityType: "running",
StartTimeUTC: p.start.Format("2006-01-02 15:04:05"),
BeginTimestampMs: p.start.UnixMilli(),
DurationSeconds: p.duration,
DistanceMeters: p.distance,
AvgSpeedMps: &speed,
AvgHR: &hr,
AerobicTrainingEffect: &aerobic,
AnaerobicTrainingEffect: &anaerobic,
RawJSON: "{}",
// ActivityName/ActivityType aren't stored columns anymore -- the API
// decodes them from RawJSON, so seeded activities need them here to
// still show a sensible name/type in the dev UI.
RawJSON: fmt.Sprintf(`{"activityName":%q,"activityType":{"typeKey":"running"}}`, p.name),
})
must(err)
return id
@@ -213,9 +213,14 @@ func seedIntervalLapsAndSamples(ctx context.Context, db *store.DB, activityID in
}
laps = append(laps, store.Lap{
LapIndex: i + 1, DurationSeconds: lapDuration,
DistanceMeters: 400, IntensityType: intensity, RawJSON: "{}",
HRDriftBpmPerMin: drift, HRRecoveryBpmPerMin: recovery,
LapIndex: i + 1,
IntensityType: intensity,
// DurationSeconds/AvgHR aren't stored columns anymore -- the API
// decodes them from RawJSON, so seeded laps need them here to
// still show a sensible duration/HR on the dev chart.
RawJSON: fmt.Sprintf(`{"duration":%v,"distance":400,"averageHR":%v}`, lapDuration, baseHR),
HRDriftBpmPerMin: drift,
HRRecoveryBpmPerMin: recovery,
})
elapsed += lapDuration
}