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

Fix MPTCP graph

This commit is contained in:
Ycarus (Yannick Chabanois) 2020-09-25 17:31:55 +02:00
parent cb129b6c3d
commit 51117fc704

View file

@ -95,28 +95,26 @@ function multipath_bandwidth()
value=(string.gsub(value, "^%[%[", ""))
value=(string.gsub(value, "%]%]", ""))
local temp1 = string.split(value, "],")
res[key][1]=temp1[1]
for i=2,60 do
res[key][i]={}
if temp1[i] ~= "" and temp1[i] ~= nil then
if temp1[2] ~= nil then
res[key][1]=temp1[1]
for i=2,60 do
res[key][i]={}
res[key][i]=(string.gsub(temp1[i], "%[", " "))
else
res[key][i]="0,0,0,0,0"
end
end
for i=1,60 do
res[key][i] = string.split(res[key][i], ",")
for j=1,5 do
if "string"== type(res[key][i][j]) then
res[key][i][j]= tonumber(res[key][i][j])
end
if "string"==type(res["total"][i][j]) then
res["total"][i][j]= tonumber(res["total"][i][j])
end
if j ==1 then
res["total"][i][j] = res[key][i][j]
else
res["total"][i][j] = res["total"][i][j] + res[key][i][j]
for i=1,60 do
res[key][i] = string.split(res[key][i], ",")
for j=1,5 do
if "string"== type(res[key][i][j]) then
res[key][i][j]= tonumber(res[key][i][j])
end
if "string"==type(res["total"][i][j]) then
res["total"][i][j]= tonumber(res["total"][i][j])
end
if j ==1 then
res["total"][i][j] = res[key][i][j]
else
res["total"][i][j] = res["total"][i][j] + res[key][i][j]
end
end
end
end