feat: train proxy and correct staffing peak fixture

This commit is contained in:
Noel Sabia committed 2026-11-14 04:45:18 +01:00
1 parent f284969a4b
commit 4b9c2da9f7
7 files changed
+575 -10

No files matched your search

+12 -4
View File
@@ -9,6 +9,13 @@ import (
)
func weekPoints(t *testing.T, values map[int]float64) []model.ForecastPoint {
t.Helper()
return weekPointsForDay(t, -1, values)
}
// weekPointsForDay builds seven days of store-hour points. Hour overrides apply
// only to day (0 = Monday), or to every day when day is negative.
func weekPointsForDay(t *testing.T, day int, values map[int]float64) []model.ForecastPoint {
t.Helper()
loc, err := time.LoadLocation(model.StoreHours.TZ)
if err != nil {
@@ -16,14 +23,14 @@ func weekPoints(t *testing.T, values map[int]float64) []model.ForecastPoint {
}
start := time.Date(2026, 11, 16, model.StoreHours.Open, 0, 0, 0, loc)
var points []model.ForecastPoint
for day := 0; day < 7; day++ {
for d := 0; d < 7; d++ {
for hour := 0; hour < model.StoreHours.Close-model.StoreHours.Open; hour++ {
v := 25.0
if override, ok := values[hour]; ok {
if override, ok := values[hour]; ok && (day < 0 || day == d) {
v = override
}
points = append(points, model.ForecastPoint{
T: start.AddDate(0, 0, day).Add(time.Duration(hour) * time.Hour).UTC(),
T: start.AddDate(0, 0, d).Add(time.Duration(hour) * time.Hour).UTC(),
V: v,
})
}
@@ -75,7 +82,8 @@ func TestBuildStandardWeek(t *testing.T) {
}
func TestBuildShiftBlocksAndPeak(t *testing.T) {
points := weekPoints(t, map[int]float64{9: 1000}) // last store hour is a peak
// One 19:00 peak on Monday only; the rest of the week stays flat at 25.
points := weekPointsForDay(t, 0, map[int]float64{9: 1000})
plan, err := Build("hn-bahnhof-01", "base", "standard", points, model.ContextData{})
if err != nil {
t.Fatalf("Build: %v", err)