feat: replace per-workout-type phase-detection settings with one global pair

The 14 phase-related profile columns (warmup/cooldown per workout type,
plus an unused Interval pair) added more granularity than wanted. Migration
0006 drops all 14 and adds a single warmup_minutes/cooldown_minutes pair
applied uniformly to every fixed-duration workout type; Interval still
detects phases from lap data directly and ignores this setting. Restores
a simplified Phase detection section in the Profile UI with just the two
fields.
This commit is contained in:
2026-07-18 08:53:21 +02:00
parent 7f4877df57
commit dfc883acb6
5 changed files with 58 additions and 52 deletions

View File

@@ -19,6 +19,9 @@ func TestProfile_DefaultsThenUpdate(t *testing.T) {
if p.HRZone1MinPct != 50 || p.HRZone5MaxPct != 100 {
t.Errorf("zone defaults = %+v, want Z1 min=50, Z5 max=100", p)
}
if p.WarmupMinutes != 10 || p.CooldownMinutes != 5 {
t.Errorf("phase-minute defaults = %+v, want warmup=10, cooldown=5", p)
}
maxHR, restingHR := 190.0, 50.0
p.GarminEmail = "runner@example.com"
@@ -26,7 +29,7 @@ func TestProfile_DefaultsThenUpdate(t *testing.T) {
p.RollingWindowDays = 120
p.MaxHeartRate = &maxHR
p.RestingHeartRate = &restingHR
p.IntervalWarmupMinutes = 8
p.WarmupMinutes = 8
if err := db.UpdateProfile(ctx, p); err != nil {
t.Fatalf("UpdateProfile: %v", err)
@@ -42,7 +45,7 @@ func TestProfile_DefaultsThenUpdate(t *testing.T) {
if got.MaxHeartRate == nil || *got.MaxHeartRate != 190 {
t.Errorf("MaxHeartRate = %v, want 190", got.MaxHeartRate)
}
if got.IntervalWarmupMinutes != 8 {
t.Errorf("IntervalWarmupMinutes = %v, want 8", got.IntervalWarmupMinutes)
if got.WarmupMinutes != 8 {
t.Errorf("WarmupMinutes = %v, want 8", got.WarmupMinutes)
}
}