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:
@@ -20,17 +20,11 @@ type Profile struct {
|
||||
HRZone4MinPct, HRZone4MaxPct float64
|
||||
HRZone5MinPct, HRZone5MaxPct float64
|
||||
|
||||
EasyWarmupMinutes, EasyCooldownMinutes float64
|
||||
LongWarmupMinutes, LongCooldownMinutes float64
|
||||
TempoWarmupMinutes, TempoCooldownMinutes float64
|
||||
Threshold30WarmupMinutes, Threshold30CooldownMinutes float64
|
||||
Threshold60WarmupMinutes, Threshold60CooldownMinutes float64
|
||||
MASTestWarmupMinutes, MASTestCooldownMinutes float64
|
||||
|
||||
// IntervalWarmupMinutes/IntervalCooldownMinutes are persisted to dedicated
|
||||
// columns (DEFAULT 0) but not yet used by phase-detection logic; reserved
|
||||
// for future Interval fixed-duration strategy if needed.
|
||||
IntervalWarmupMinutes, IntervalCooldownMinutes float64
|
||||
// WarmupMinutes/CooldownMinutes apply uniformly to every fixed-duration
|
||||
// workout type's phase detection (Easy, Long, Tempo, Threshold 30'/60',
|
||||
// MAS Test). Interval workouts detect phases from lap data directly and
|
||||
// don't use these.
|
||||
WarmupMinutes, CooldownMinutes float64
|
||||
|
||||
CreatedAt, UpdatedAt string
|
||||
}
|
||||
@@ -40,12 +34,7 @@ const profileColumns = `
|
||||
hr_zone1_min_pct, hr_zone1_max_pct, hr_zone2_min_pct, hr_zone2_max_pct,
|
||||
hr_zone3_min_pct, hr_zone3_max_pct, hr_zone4_min_pct, hr_zone4_max_pct,
|
||||
hr_zone5_min_pct, hr_zone5_max_pct,
|
||||
easy_warmup_minutes, easy_cooldown_minutes, long_warmup_minutes, long_cooldown_minutes,
|
||||
tempo_warmup_minutes, tempo_cooldown_minutes,
|
||||
threshold30_warmup_minutes, threshold30_cooldown_minutes,
|
||||
threshold60_warmup_minutes, threshold60_cooldown_minutes,
|
||||
mas_test_warmup_minutes, mas_test_cooldown_minutes,
|
||||
interval_warmup_minutes, interval_cooldown_minutes,
|
||||
warmup_minutes, cooldown_minutes,
|
||||
created_at, updated_at
|
||||
`
|
||||
|
||||
@@ -57,12 +46,7 @@ func (db *DB) GetProfile(ctx context.Context) (Profile, error) {
|
||||
&p.HRZone1MinPct, &p.HRZone1MaxPct, &p.HRZone2MinPct, &p.HRZone2MaxPct,
|
||||
&p.HRZone3MinPct, &p.HRZone3MaxPct, &p.HRZone4MinPct, &p.HRZone4MaxPct,
|
||||
&p.HRZone5MinPct, &p.HRZone5MaxPct,
|
||||
&p.EasyWarmupMinutes, &p.EasyCooldownMinutes, &p.LongWarmupMinutes, &p.LongCooldownMinutes,
|
||||
&p.TempoWarmupMinutes, &p.TempoCooldownMinutes,
|
||||
&p.Threshold30WarmupMinutes, &p.Threshold30CooldownMinutes,
|
||||
&p.Threshold60WarmupMinutes, &p.Threshold60CooldownMinutes,
|
||||
&p.MASTestWarmupMinutes, &p.MASTestCooldownMinutes,
|
||||
&p.IntervalWarmupMinutes, &p.IntervalCooldownMinutes,
|
||||
&p.WarmupMinutes, &p.CooldownMinutes,
|
||||
&p.CreatedAt, &p.UpdatedAt,
|
||||
)
|
||||
if err != nil {
|
||||
@@ -81,24 +65,14 @@ func (db *DB) UpdateProfile(ctx context.Context, p Profile) error {
|
||||
hr_zone1_min_pct=?, hr_zone1_max_pct=?, hr_zone2_min_pct=?, hr_zone2_max_pct=?,
|
||||
hr_zone3_min_pct=?, hr_zone3_max_pct=?, hr_zone4_min_pct=?, hr_zone4_max_pct=?,
|
||||
hr_zone5_min_pct=?, hr_zone5_max_pct=?,
|
||||
easy_warmup_minutes=?, easy_cooldown_minutes=?, long_warmup_minutes=?, long_cooldown_minutes=?,
|
||||
tempo_warmup_minutes=?, tempo_cooldown_minutes=?,
|
||||
threshold30_warmup_minutes=?, threshold30_cooldown_minutes=?,
|
||||
threshold60_warmup_minutes=?, threshold60_cooldown_minutes=?,
|
||||
mas_test_warmup_minutes=?, mas_test_cooldown_minutes=?,
|
||||
interval_warmup_minutes=?, interval_cooldown_minutes=?,
|
||||
warmup_minutes=?, cooldown_minutes=?,
|
||||
updated_at=datetime('now')
|
||||
WHERE id = 1`,
|
||||
p.GarminEmail, p.GarminPassword, p.RollingWindowDays, p.MaxHeartRate, p.RestingHeartRate,
|
||||
p.HRZone1MinPct, p.HRZone1MaxPct, p.HRZone2MinPct, p.HRZone2MaxPct,
|
||||
p.HRZone3MinPct, p.HRZone3MaxPct, p.HRZone4MinPct, p.HRZone4MaxPct,
|
||||
p.HRZone5MinPct, p.HRZone5MaxPct,
|
||||
p.EasyWarmupMinutes, p.EasyCooldownMinutes, p.LongWarmupMinutes, p.LongCooldownMinutes,
|
||||
p.TempoWarmupMinutes, p.TempoCooldownMinutes,
|
||||
p.Threshold30WarmupMinutes, p.Threshold30CooldownMinutes,
|
||||
p.Threshold60WarmupMinutes, p.Threshold60CooldownMinutes,
|
||||
p.MASTestWarmupMinutes, p.MASTestCooldownMinutes,
|
||||
p.IntervalWarmupMinutes, p.IntervalCooldownMinutes,
|
||||
p.WarmupMinutes, p.CooldownMinutes,
|
||||
)
|
||||
if err != nil {
|
||||
return fmt.Errorf("update profile: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user