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
All checks were successful
ci/woodpecker/push/build-image Pipeline was successful
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user