Minor temp_c_block and ecco_lcl problem

In temp_c_block, when using ecco_lcl at line 284 “humidy_trend” = ‘n/a’
at 285 the value \$weather[“humidity_trend”] evaluates as > 0 and the block always shows an up arrow regardsless of actual trend rather falling through to \$arrow=’ ’

``````if(array_key_exists("humidity_trend",\$weather))
{  if     ( \$weather["humidity_trend"] = 'n/a'){ \$arrow      = '';}
elseif ( \$weather["humidity_trend"] > 0) { \$arrow       = '&uarr;';}
elseif ( \$weather["humidity_trend"] < 0) { \$arrow       = '&darr;';}
else                                     { \$arrow       = '';}
``````

solves the problem but may not be the best solution.

Regards,

Jim

Thanks for spotting this.

``````if(array_key_exists("humidity_trend",\$weather))
{  if     ( \$weather["humidity_trend"] = 'n/a'){ \$arrow      = '';}
elseif ( \$weather["humidity_trend"] > 0) { \$arrow       = '&uarr;';}
elseif ( \$weather["humidity_trend"] < 0) { \$arrow       = '&darr;';}
else                                     { \$arrow       = '';}
``````

There should be two or three = in the first “if” line
= means set the value on the left to the value on the right, which is always true, so always no arrow
==” or “===” compares left item with right item and there will be no arrow, only if the value in the field equals to “n/a”

``````     {  if     ( \$weather["humidity_trend"]   ==    'n/a'){ \$arrow      = '';}
``````

Thanks for spotting this,
Will be in an update but in two weeks as there were other requests for that block also which need to be tested.

Wim

1 Like

Regards,

Jim