Current Block (v24) - Showing incorrect Alternate Values

Post Reply
User avatar
MonyMony
Forecaster
Forecaster
Posts: 187
Joined: Sun Aug 20, 2017 12:54 pm
Location: Elkton, Maryland, US
Station model: Davis Pro 2
Software: WeatherCat/Meteobridge
Contact:

Current Block (v24) - Showing incorrect Alternate Values

Post by MonyMony » Sun Feb 25, 2018 3:21 pm

I installed the new version and activated the option to show Alternate Values.
Screen Shot 2018-02-25 at 10.11.15 AM.png
Screen Shot 2018-02-25 at 10.11.15 AM.png (52.37 KiB) Viewed 4511 times
Unfortunately the Alternate Pressure and Wind Speed units are getting ignored.
Screen Shot 2018-02-25 at 10.11.03 AM.png
Screen Shot 2018-02-25 at 10.11.03 AM.png (106.26 KiB) Viewed 4511 times
I looked at the code and the values appear to be hard coded so guessing something got missed in the update.

$alternativeW = "mph";
$alternativeP = "inhg";

Nice update and BTW, congrats on the new job Jachym!
Image

User avatar
MonyMony
Forecaster
Forecaster
Posts: 187
Joined: Sun Aug 20, 2017 12:54 pm
Location: Elkton, Maryland, US
Station model: Davis Pro 2
Software: WeatherCat/Meteobridge
Contact:

Re: Current Block (v24) - Showing incorrect Alternate Values

Post by MonyMony » Sun Feb 25, 2018 3:29 pm

Additionally, if I update the code to set:

$alternativeP = "hpa";

or

$alternativeP = "mmhg";

Then the block completely breaks:
Screen Shot 2018-02-25 at 10.27.16 AM.png
Screen Shot 2018-02-25 at 10.27.16 AM.png (73.93 KiB) Viewed 4510 times
Manually updating $alternateW works as expected.
Image

User avatar
magical46
Observer
Observer
Posts: 49
Joined: Mon Aug 21, 2017 2:19 pm
Location: Farnham, Surrey, UK
Contact:

Re: Current Block (v24) - Showing incorrect Alternate Values

Post by magical46 » Sun Feb 25, 2018 4:07 pm

Getting the same issue here.
www.philsweather.co.uk
Temp's and precipitation show alternates but wind and pressure show same value twice.
Phil
Image

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Current Block (v24) - Showing incorrect Alternate Values

Post by Jachym » Sun Feb 25, 2018 8:16 pm

Interesting, I will have a look

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Current Block (v24) - Showing incorrect Alternate Values

Post by Jachym » Sun Feb 25, 2018 8:18 pm

I think I know...

try opening currentBlock.php

lines 198 and 199

$alternativeW = "mph";
$alternativeP = "inhg";

Delete them. These were for testing purposes and looks like I forgot to delete them.

Please let me know if that solved the problem

User avatar
MonyMony
Forecaster
Forecaster
Posts: 187
Joined: Sun Aug 20, 2017 12:54 pm
Location: Elkton, Maryland, US
Station model: Davis Pro 2
Software: WeatherCat/Meteobridge
Contact:

Re: Current Block (v24) - Showing incorrect Alternate Values

Post by MonyMony » Mon Feb 26, 2018 12:41 pm

Jachym wrote: Sun Feb 25, 2018 8:18 pm I think I know...

try opening currentBlock.php

lines 198 and 199

$alternativeW = "mph";
$alternativeP = "inhg";

Delete them. These were for testing purposes and looks like I forgot to delete them.

Please let me know if that solved the problem
Hi Jachym,

No joy.... If I remove them then the block is blank.
Screen Shot 2018-02-26 at 7.40.43 AM.png
Screen Shot 2018-02-26 at 7.40.43 AM.png (33.12 KiB) Viewed 4479 times
Image

User avatar
MonyMony
Forecaster
Forecaster
Posts: 187
Joined: Sun Aug 20, 2017 12:54 pm
Location: Elkton, Maryland, US
Station model: Davis Pro 2
Software: WeatherCat/Meteobridge
Contact:

Re: Current Block (v24) - Showing incorrect Alternate Values

Post by MonyMony » Mon Feb 26, 2018 1:00 pm

Figured out the problem...

In lines 1694 thru 1764 the Eval function is missing the closing parenthesis. Once I add that then everything works. I changed it to this:

Code: Select all

if(json['P']!=$("#currentPValue").text()){
	changeP = true;
}
else{
	changeP = false;
}
$("#currentPValue").text(json['P']);
<?php 
	if($dualUnits){
?>
		if(json['P']!="--"){
			<?php 
				if($displayPressUnits=="hpa" && $alternativeP == "inhg"){
			?>
					altP = eval(json['P']) * 0.02952);
					altP = altP.toFixed(2);
			<?php 
				}
			?>
			<?php
				if($displayPressUnits=="inhg" && $alternativeP == "hpa"){
			?>
					altP = (eval(json['P']) * 33.8638);
					altP = altP.toFixed(1);
			<?php
				}
			?>
			<?php
				if($displayPressUnits=="hpa" && $alternativeP == "mmhg"){
			?>
					altP = (eval(json['P']) * 0.75006);
					altP = altP.toFixed(1);
			<?php
				}
			?>
			<?php
				if($displayPressUnits=="mmhg" && $alternativeP == "hpa"){
			?>
					altP = (eval(json['P']) * 1.3332);
					altP = altP.toFixed(1);
			<?php
				}
			?>
			<?php
				if($displayPressUnits=="inhg" && $alternativeP == "mmhg"){
			?>
					altP = (eval(json['P']) * 25.3999);
					altP = altP.toFixed(1);
			<?php
				}
			?>
			<?php
				if($displayPressUnits=="mmhg" && $alternativeP == "inhg"){
			?>
					altP = (eval(json['P']) * 0.03937);
					altP = altP.toFixed(2);
			<?php
				}
			?>
			<?php 
				if($displayPressUnits==$alternativeP){
			?>
					altP = json['P'];
			<?php 
				}
			?>
		}
		$("#currentPValueAlt").text(altP);
<?php
	}
?>
Image

User avatar
MonyMony
Forecaster
Forecaster
Posts: 187
Joined: Sun Aug 20, 2017 12:54 pm
Location: Elkton, Maryland, US
Station model: Davis Pro 2
Software: WeatherCat/Meteobridge
Contact:

Re: Current Block (v24) - Showing incorrect Alternate Values

Post by MonyMony » Mon Feb 26, 2018 1:37 pm

One very minor issue though...

If I change my site to Metric (normally Imperial Units), then those alternate values do not change back to their normally default units. Honestly I don't mind if this left this way as it is a low possibility that anyone would notice, but figured I would point it out just so you are aware.

Site changed to Metric:
Screen Shot 2018-02-26 at 8.34.22 AM.png
Screen Shot 2018-02-26 at 8.34.22 AM.png (43.24 KiB) Viewed 4473 times
Site set to Default Units (Imperial)
Screen Shot 2018-02-26 at 8.38.29 AM.png
Screen Shot 2018-02-26 at 8.38.29 AM.png (40.2 KiB) Viewed 4471 times
Thanks again for adding the Alternate Values to the CURRENT module. This is something I have been hoping to see for some time. :D
Image

User avatar
magical46
Observer
Observer
Posts: 49
Joined: Mon Aug 21, 2017 2:19 pm
Location: Farnham, Surrey, UK
Contact:

Re: Current Block (v24) - Showing incorrect Alternate Values

Post by magical46 » Wed Feb 28, 2018 7:21 pm

Just installed the updated version (24.1) but with "Show alternate values" selected its not showing any values at all.
www.philsweather.co.uk

Phil
Image

User avatar
Fraggboy
Forecaster
Forecaster
Posts: 193
Joined: Wed Sep 27, 2017 2:45 pm
Location: Sunny California
Station model: Bloomsky II + Storm
Software: Bloomsky
Contact:

Re: Current Block (v24) - Showing incorrect Alternate Values

Post by Fraggboy » Wed Feb 28, 2018 10:04 pm

Mine was showing blank also after downloading the latest update.

Once I followed MonyMony's post above, I modified the currentBlock.php file and it's working great. Instead of adding the ending parenthesis, I removed the beginning parenthesis which worked for me.
Image

Post Reply