fix issue with rendering logic in weather card

This commit is contained in:
big nutty 2024-08-18 10:45:54 +00:00
parent e326988896
commit edd2ef52d2
2 changed files with 2 additions and 2 deletions

View file

@ -39,7 +39,7 @@ function renderWeatherCard(context, data, units){
// Render weather alerts // Render weather alerts
if(data.result.warnings.length >= 1){ if(data.result.warnings.length >= 1){
for(const w of data.result.warnings.splice(0, 1)){ for(const w of [data.result.warnings[0]]){
if(description.includes(stringwrap(w.label, 50))) continue; if(description.includes(stringwrap(w.label, 50))) continue;
description += `\n\n${icon("weather_warning_" + (w.icon || "generic").toLowerCase())} **${stringwrap(w.label, 50)}**\n-# ${stringwrap(w.source, 50)}${link(w.url, "Learn More", "Learn more about this alert")}` description += `\n\n${icon("weather_warning_" + (w.icon || "generic").toLowerCase())} **${stringwrap(w.label, 50)}**\n-# ${stringwrap(w.source, 50)}${link(w.url, "Learn More", "Learn more about this alert")}`
} }

View file

@ -39,7 +39,7 @@ function renderWeatherCard(context, data, units){
// Render weather alerts // Render weather alerts
if(data.result.warnings.length >= 1){ if(data.result.warnings.length >= 1){
for(const w of data.result.warnings.splice(0, 1)){ for(const w of [data.result.warnings[0]]){
if(description.includes(stringwrap(w.label, 50))) continue; if(description.includes(stringwrap(w.label, 50))) continue;
description += `\n\n${icon("weather_warning_" + (w.icon || "generic").toLowerCase())} **${stringwrap(w.label, 50)}**\n-# ${stringwrap(w.source, 50)}${link(w.url, "Learn More", "Learn more about this alert")}` description += `\n\n${icon("weather_warning_" + (w.icon || "generic").toLowerCase())} **${stringwrap(w.label, 50)}**\n-# ${stringwrap(w.source, 50)}${link(w.url, "Learn More", "Learn more about this alert")}`
} }