Add Weekend Outlook generation

This commit is contained in:
2026-05-29 18:16:10 +00:00
parent 4c9d396f9b
commit 5d543b6b4d
21 changed files with 760 additions and 69 deletions

View File

@@ -44,11 +44,18 @@ func BuildThreeDay(ctx BuildContext, summaries []forecast.DailySummary) (Package
WeatherStory: buildWeatherStory(ctx.Bundle),
},
}
alerts := map[string]forecast.AlertOverlap{}
for _, summary := range summaries {
day := buildOutlookDay(summary)
pkg.ThreeDay.Days = append(pkg.ThreeDay.Days, day)
for _, alert := range summary.AlertOverlaps {
}
pkg.ThreeDay.RelevantAlerts = collectOutlookAlerts(pkg.ThreeDay.Days)
return pkg, nil
}
func collectOutlookAlerts(days []OutlookDay) []forecast.AlertOverlap {
alerts := map[string]forecast.AlertOverlap{}
for _, day := range days {
for _, alert := range day.RelevantAlerts {
key := alert.Event
if key == "" {
key = alert.Headline
@@ -63,10 +70,11 @@ func BuildThreeDay(ctx BuildContext, summaries []forecast.DailySummary) (Package
keys = append(keys, key)
}
sort.Strings(keys)
out := make([]forecast.AlertOverlap, 0, len(keys))
for _, key := range keys {
pkg.ThreeDay.RelevantAlerts = append(pkg.ThreeDay.RelevantAlerts, alerts[key])
out = append(out, alerts[key])
}
return pkg, nil
return out
}
func buildOutlookDay(summary forecast.DailySummary) OutlookDay {