1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Fix when total <0

This commit is contained in:
Ycarus (Yannick Chabanois) 2021-03-29 21:04:47 +02:00
parent 0cf6ea2d44
commit a19acf17b3

View file

@ -74,7 +74,6 @@ function multipath_bandwidth()
multipath = "off"
end
if multipath == "on" or multipath == "master" or multipath == "backup" or multipath == "handover" then
local bwc = luci.sys.exec("luci-bwc -i %q 2>/dev/null" % dev) or ""
local bwc = luci.sys.exec("luci-bwc -i %q 2>/dev/null" % dev) or ""
if bwc ~= nil then
--result[dev] = "[" .. string.gsub(bwc, '[\r\n]', '') .. "]"
@ -121,13 +120,13 @@ function multipath_bandwidth()
res[key][i][j]= tonumber(res[key][i][j])
res["total"][i][j]= tonumber(res["total"][i][j])
if j ==1 then
if res[key][i][j] ~= nil then
if res[key][i][j] ~= nil and res[key][i][j] > 0 then
res["total"][i][j] = res[key][i][j]
else
res["total"][i][j] = 0
end
else
if res[key][i][j] ~= nil then
if res[key][i][j] ~= nil and res[key][i][j] > 0 then
res["total"][i][j] = res["total"][i][j] + res[key][i][j]
end
end