Move backfill horizon from a startup env var into the editable profile
SMARTRUN_BACKFILL_HORIZON_DAYS was a server-startup-only env var with no UI, defaulting to 3 years -- so editing the unrelated "Rolling window" profile field (for classification, not sync) had no effect on how far back Sync Now reached. Backfill horizon is now Profile.BackfillHorizonDays, read fresh on every Backfill call, with its own field on the Profile page.
This commit is contained in:
@@ -22,6 +22,9 @@ func TestProfile_DefaultsThenUpdate(t *testing.T) {
|
||||
if p.WarmupMinutes != 10 || p.CooldownMinutes != 5 {
|
||||
t.Errorf("phase-minute defaults = %+v, want warmup=10, cooldown=5", p)
|
||||
}
|
||||
if p.BackfillHorizonDays != 1095 {
|
||||
t.Errorf("BackfillHorizonDays = %d, want 1095 (migration default)", p.BackfillHorizonDays)
|
||||
}
|
||||
|
||||
maxHR, restingHR := 190.0, 50.0
|
||||
p.GarminEmail = "runner@example.com"
|
||||
@@ -30,6 +33,7 @@ func TestProfile_DefaultsThenUpdate(t *testing.T) {
|
||||
p.MaxHeartRate = &maxHR
|
||||
p.RestingHeartRate = &restingHR
|
||||
p.WarmupMinutes = 8
|
||||
p.BackfillHorizonDays = 14
|
||||
|
||||
if err := db.UpdateProfile(ctx, p); err != nil {
|
||||
t.Fatalf("UpdateProfile: %v", err)
|
||||
@@ -48,4 +52,7 @@ func TestProfile_DefaultsThenUpdate(t *testing.T) {
|
||||
if got.WarmupMinutes != 8 {
|
||||
t.Errorf("WarmupMinutes = %v, want 8", got.WarmupMinutes)
|
||||
}
|
||||
if got.BackfillHorizonDays != 14 {
|
||||
t.Errorf("BackfillHorizonDays = %v, want 14", got.BackfillHorizonDays)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user