Move ignoreToday logic into template to fix undefined forecast

This commit is contained in:
rejas 2021-08-01 09:39:07 +02:00
parent 99114b2a61
commit 745a5f0376
2 changed files with 5 additions and 6 deletions

View File

@ -2,6 +2,9 @@
{% set numSteps = forecast | calcNumSteps %}
{% set currentStep = 0 %}
<table class="{{ config.tableClass }}">
{% if config.ignoreToday %}
{% set forecast = forecast.splice(1) %}
{% endif %}
{% set forecast = forecast.slice(0, numSteps) %}
{% for f in forecast %}
<tr {% if config.colored %}class="colored"{% endif %} {% if config.fade %}style="opacity: {{ currentStep | opacity(numSteps) }};"{% endif %}>

View File

@ -132,10 +132,6 @@ Module.register("weather", {
getTemplateData: function () {
const forecast = this.weatherProvider.weatherForecast();
if (this.config.ignoreToday) {
forecast.splice(0, 1);
}
return {
config: this.config,
current: this.weatherProvider.currentWeather(),