Skip to content

Commit

Permalink
Fixed a bug causing all totals to show up as zero.
Browse files Browse the repository at this point in the history
  • Loading branch information
vortex-5 committed Sep 1, 2019
1 parent f7b78da commit f79cc00
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions bwmon/www/bwmon.js
Original file line number Diff line number Diff line change
Expand Up @@ -617,41 +617,51 @@ bwmon.controller('MainController', ['$scope', '$interval', '$http', '$location',
};

$scope.getTotals = function(devices) {
let subTotal = 0;
for (let i = 0; i < devices.length; i++) {
subTotal += $scope.getDeviceTotal(devices[i]);
let total = 0;
for (let macAddress in devices) {
if (devices.hasOwnProperty(macAddress)) {
total += $scope.getDeviceTotal(devices[macAddress]);
}
}
return subTotal;
return total;
};

$scope.getTotalDown = function(devices) {
let total = 0;
for (let i = 0; i < devices.length; i++) {
total += devices[i].postDown;
for (let macAddress in devices) {
if (devices.hasOwnProperty(macAddress)) {
total += devices[macAddress].postDown;
}
}
return total;
};

$scope.getTotalUp = function(devices) {
let total = 0;
for (let i = 0; i < devices.length; i++) {
total += devices[i].postUp;
for (let macAddress in devices) {
if (devices.hasOwnProperty(macAddress)) {
total += devices[macAddress].postUp;
}
}
return total;
};

$scope.getTotalDownRate = function(devices) {
let total = 0;
for (let i = 0; i < devices.length; i++) {
total += $scope.getDownRate(devices[i]);
for (let macAddress in devices) {
if (devices.hasOwnProperty(macAddress)) {
total += $scope.getDownRate(devices[macAddress]);
}
}
return total;
};

$scope.getTotalUpRate = function(devices) {
let total = 0;
for (let i = 0; i < devices.length; i++) {
total += $scope.getUpRate(devices[i]);
for (let macAddress in devices) {
if (devices.hasOwnProperty(macAddress)) {
total += $scope.getUpRate(devices[macAddress]);
}
}
return total;
};
Expand Down

0 comments on commit f79cc00

Please sign in to comment.