Normalize briefing module options and weather stories
This commit is contained in:
@@ -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"`
|
||||
|
||||
Reference in New Issue
Block a user