Update to support upstream weatherfeeder v0.12.1 and add ends field to the alerts schema
All checks were successful
ci/woodpecker/push/build-image Pipeline was successful

This commit is contained in:
2026-06-16 20:08:03 -05:00
parent f4dd701204
commit 2a33fe01cf
15 changed files with 117 additions and 36 deletions

View File

@@ -147,6 +147,7 @@ func cloneAlert(alert model.WeatherAlert) model.WeatherAlert {
out.Sent = copyTime(alert.Sent)
out.Effective = copyTime(alert.Effective)
out.Onset = copyTime(alert.Onset)
out.Ends = copyTime(alert.Ends)
out.Expires = copyTime(alert.Expires)
if alert.References != nil {
out.References = make([]model.AlertReference, len(alert.References))
@@ -170,7 +171,11 @@ func isActiveAlert(alert model.WeatherAlert, activeAt time.Time) bool {
if alert.Effective != nil && activeAt.Before(*alert.Effective) {
return false
}
if alert.Expires != nil && !activeAt.Before(*alert.Expires) {
endBoundary := alert.Ends
if endBoundary == nil {
endBoundary = alert.Expires
}
if endBoundary != nil && !activeAt.Before(*endBoundary) {
return false
}
return true