Compare commits

...

2 Commits

Author SHA1 Message Date
2e3cfb44f4 Don't enrich nil updates
All checks were successful
Build and Publish / release (push) Successful in 2m48s
2025-01-05 17:37:14 -05:00
be8a4f3bca Don't enrich nil updates 2025-01-05 17:36:39 -05:00
2 changed files with 5 additions and 0 deletions

View File

@ -85,6 +85,7 @@ func (aw *AmbientWeather) handleProviderRequest(
w.WriteHeader(http.StatusInternalServerError) w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte(err.Error())) w.Write([]byte(err.Error()))
return
} }
// Calculate any fields that may be missing // Calculate any fields that may be missing

View File

@ -5,6 +5,10 @@ import "math"
// Attempts to complete missing fields that may not // Attempts to complete missing fields that may not
// be set by a specific provider, such as DewPoint and WindChill // be set by a specific provider, such as DewPoint and WindChill
func (u *WeatherUpdate) Enrich() { func (u *WeatherUpdate) Enrich() {
if u == nil {
return
}
if u.WindChillF == 0 { if u.WindChillF == 0 {
u.WindChillF = CalculateWindChill(u.TempOutdoorF, u.WindSpeedMPH) u.WindChillF = CalculateWindChill(u.TempOutdoorF, u.WindSpeedMPH)
} }