From 6beeedc73251278fc18df9c364e1874ac1ccde6c Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 13 Mar 2017 12:55:58 +0100 Subject: [PATCH] More codacy --- scripts/pi-hole/js/index.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index 51c10dee..16c9d66f 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -148,21 +148,23 @@ function updateForwardedOverTime() { { if (!{}.hasOwnProperty.call(timestamps, j)) continue; var sum = 0.0; - for (var i in plotdata[j]) + var key; + for (key in plotdata[j]) { - sum += plotdata[j][i]; + if (!{}.hasOwnProperty.call(plotdata[j], key)) continue; + sum += plotdata[j][key]; } var dd = []; - for (var i in plotdata[j]) + for (key in plotdata[j]) { - if (!{}.hasOwnProperty.call(plotdata[j], i)) continue; - var singlepoint = plotdata[j][i]; + if (!{}.hasOwnProperty.call(plotdata[j], key)) continue; + var singlepoint = plotdata[j][key]; if(singlepoint === 0) { // Don't plot this line singlepoint = NaN; } - forwardDestinationChart.data.datasets[i].data.push(singlepoint/sum); + forwardDestinationChart.data.datasets[key].data.push(singlepoint/sum); } var d = new Date(1000*parseInt(timestamps[j]));