Second try...
This commit is contained in:
parent
4f2bf621be
commit
b0144108a8
1 changed files with 12 additions and 6 deletions
|
@ -45,15 +45,18 @@ function action_index()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function compare(a, b)
|
local function compare(a, b)
|
||||||
if tonumber(a.ETX) == 0 then
|
local c = tonumber(a.ETX)
|
||||||
|
local d = tonumber(b.ETX)
|
||||||
|
|
||||||
|
if not c or c == 0 then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
if tonumber(b.ETX) == 0 then
|
if not d or d == 0 then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
return tonumber(a.ETX) < tonumber(b.ETX)
|
return c < d
|
||||||
end
|
end
|
||||||
|
|
||||||
table.sort(data.Links, compare)
|
table.sort(data.Links, compare)
|
||||||
|
@ -70,15 +73,18 @@ function action_routes()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function compare(a, b)
|
local function compare(a, b)
|
||||||
if tonumber(a.ETX) == 0 then
|
local c = tonumber(a.ETX)
|
||||||
|
local d = tonumber(b.ETX)
|
||||||
|
|
||||||
|
if not c or c == 0 then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
if tonumber(b.ETX) == 0 then
|
if not d or d == 0 then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
return tonumber(a.ETX) < tonumber(b.ETX)
|
return c < d
|
||||||
end
|
end
|
||||||
|
|
||||||
table.sort(data.Routes, compare)
|
table.sort(data.Routes, compare)
|
||||||
|
|
Loading…
Reference in a new issue