Author: zecas Date: Wed Nov 4 08:32:35 2015 New Revision: 124 URL: http://svn.gna.org/viewcvs/zzzt?rev=124&view=rev Log: fix js case of day without any stat
Modified: trunk/stats/index.php trunk/stats/update.js Modified: trunk/stats/index.php URL: http://svn.gna.org/viewcvs/zzzt/trunk/stats/index.php?rev=124&r1=123&r2=124&view=diff ============================================================================== --- trunk/stats/index.php (original) +++ trunk/stats/index.php Wed Nov 4 08:32:35 2015 @@ -59,7 +59,14 @@ table { width: 100%;} #holderP { width: 100%; height: 400px; } #holderR { width: 100%; height: 300px; } - #last { position: absolute; top: 4em; right: 1em; } + #last { + position: absolute; + top: 4em; + right: 1em; + background-color: #ddd; + border-radius: 0.5em; + padding: 0.5em; + } </style> </head> <body> @@ -196,7 +203,7 @@ </TD></tr> </table> - <div id='last'></div> + <div id='last' title='<?php echo LAST_MEASURES;?>'></div> </body> @@ -231,10 +238,12 @@ var chartR = Morris.Line({element: 'holderR', lineColors: ['#1751A7','#006600'], pointSize: 0, hideHover: 'auto', lineWidth: 1, data: tabR, xkey: 'h', ykeys: ['r','t'], labels: ['<?php echo EFFICIENCY;?>','<?php echo TKK;?>'] }); - document.getElementById("last").innerHTML = - tabP[tabP.length-1]['h'].substr(-5,5)+' ' + - tabP[tabP.length-1]['a']+'W ' + - tabP[tabP.length-1]['k']/100+'kWh'; + if (typeof tabP[0] !== 'undefined') { + document.getElementById("last").innerHTML = + tabP[tabP.length-1]['h'].substr(-5,5)+' ' + + tabP[tabP.length-1]['a']+'W ' + + tabP[tabP.length-1]['k']/100+'kWh'; + } </script> Modified: trunk/stats/update.js URL: http://svn.gna.org/viewcvs/zzzt/trunk/stats/update.js?rev=124&r1=123&r2=124&view=diff ============================================================================== --- trunk/stats/update.js (original) +++ trunk/stats/update.js Wed Nov 4 08:32:35 2015 @@ -28,7 +28,9 @@ tabP[tabP.length-1]['k']/100+'kWh'; } } - var maintenant=encodeURIComponent(tabP[tabP.length-1]['h']); + if (typeof tabP !== 'undefined') { + var maintenant=encodeURIComponent(tabP[tabP.length-1]['h']); + } xhttp.open("GET", "updateP.php?datetime="+maintenant, true); xhttp.send(); _______________________________________________ Zzzt-commits mailing list Zzzt-commits@gna.org https://mail.gna.org/listinfo/zzzt-commits