2026-05-29 18:16:10 +00:00
|
|
|
package changes
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
|
2026-06-09 21:20:53 +00:00
|
|
|
"gitea.maximumdirect.net/eric/weatherreporter/internal/module"
|
2026-05-29 18:16:10 +00:00
|
|
|
)
|
|
|
|
|
|
2026-06-09 21:20:53 +00:00
|
|
|
func CompareWeekend(previous module.Snapshot, current module.Snapshot, thresholds Thresholds) ([]Change, error) {
|
|
|
|
|
previousDayparts, err := requiredStanza[map[string]daypartSummaryStanza](previous, "derived_daypart_summaries")
|
2026-05-29 18:16:10 +00:00
|
|
|
if err != nil {
|
2026-06-09 21:20:53 +00:00
|
|
|
return nil, fmt.Errorf("previous weekend daypart summaries: %w", err)
|
2026-05-29 18:16:10 +00:00
|
|
|
}
|
2026-06-09 21:20:53 +00:00
|
|
|
currentDayparts, err := requiredStanza[map[string]daypartSummaryStanza](current, "derived_daypart_summaries")
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, fmt.Errorf("current weekend daypart summaries: %w", err)
|
2026-05-29 18:16:10 +00:00
|
|
|
}
|
2026-06-09 21:20:53 +00:00
|
|
|
return compareOutlookDays(outlookDaysFromDayparts(previousDayparts), outlookDaysFromDayparts(currentDayparts), thresholds, "weekend_")
|
2026-05-29 18:16:10 +00:00
|
|
|
}
|