Normalize briefing module options and weather stories

This commit is contained in:
2026-08-13 00:53:31 +00:00
parent 730929e2ed
commit 9b4e53702b
12 changed files with 188 additions and 19 deletions

View File

@@ -4,6 +4,7 @@ package weatherdata
import (
"encoding/json"
"math"
"strings"
"time"
)
@@ -180,6 +181,15 @@ type WeatherStory struct {
DownloadURL string `json:"downloadUrl,omitempty"`
}
// HasUsableContent reports whether the weather story contains displayable content or a valid period.
func (s WeatherStory) HasUsableContent() bool {
return strings.TrimSpace(s.Title) != "" ||
strings.TrimSpace(s.Description) != "" ||
strings.TrimSpace(s.AltText) != "" ||
strings.TrimSpace(s.DownloadURL) != "" ||
(!s.StartTime.IsZero() && !s.EndTime.IsZero() && s.EndTime.After(s.StartTime))
}
type ConvectiveOutlookRun struct {
LocationID string `json:"locationId,omitempty"`
LocationName string `json:"locationName,omitempty"`