mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-28 12:12:20 +00:00
Move ignoreToday logic into template to fix undefined forecast
This commit is contained in:
parent
99114b2a61
commit
745a5f0376
@ -2,6 +2,9 @@
|
|||||||
{% set numSteps = forecast | calcNumSteps %}
|
{% set numSteps = forecast | calcNumSteps %}
|
||||||
{% set currentStep = 0 %}
|
{% set currentStep = 0 %}
|
||||||
<table class="{{ config.tableClass }}">
|
<table class="{{ config.tableClass }}">
|
||||||
|
{% if config.ignoreToday %}
|
||||||
|
{% set forecast = forecast.splice(1) %}
|
||||||
|
{% endif %}
|
||||||
{% set forecast = forecast.slice(0, numSteps) %}
|
{% set forecast = forecast.slice(0, numSteps) %}
|
||||||
{% for f in forecast %}
|
{% for f in forecast %}
|
||||||
<tr {% if config.colored %}class="colored"{% endif %} {% if config.fade %}style="opacity: {{ currentStep | opacity(numSteps) }};"{% endif %}>
|
<tr {% if config.colored %}class="colored"{% endif %} {% if config.fade %}style="opacity: {{ currentStep | opacity(numSteps) }};"{% endif %}>
|
||||||
|
@ -132,10 +132,6 @@ Module.register("weather", {
|
|||||||
getTemplateData: function () {
|
getTemplateData: function () {
|
||||||
const forecast = this.weatherProvider.weatherForecast();
|
const forecast = this.weatherProvider.weatherForecast();
|
||||||
|
|
||||||
if (this.config.ignoreToday) {
|
|
||||||
forecast.splice(0, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
config: this.config,
|
config: this.config,
|
||||||
current: this.weatherProvider.currentWeather(),
|
current: this.weatherProvider.currentWeather(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user