fix(flows): egne flows øverst, kædeflows samlet nederst uden 'Kæde: ' (v1.61.2.0)

This commit is contained in:
2026-09-30 17:14:08 +02:00
parent acf94c8e88
commit bd106a2176
7 changed files with 27 additions and 6 deletions
+20 -2
View File
@@ -52,20 +52,38 @@ end
-- Tavlen: forsyning ("Ind til bygning") først, så udkørsel ("Ud fra bygning"); hver gruppe efter navn.
-- {{kind, runs}, ...}; tomme grupper udelades.
-- Spillerens egne flows først (forsyning, udkørsel), så kædernes egne flows (run.chain) samlet til sidst
-- (in-game 30/9: "Kæde: …"-flows blandede sig alfabetisk ind mellem de flows spilleren selv har sat op).
function ADFlowView.boardGroups(runs)
local byKind = {supply = {}, outbound = {}}
local chainRuns = {}
for _, run in ipairs(runs or {}) do
table.insert(byKind[run.kind == "outbound" and "outbound" or "supply"], run)
if run.chain ~= nil and run.chain ~= "" then
table.insert(chainRuns, run)
else
table.insert(byKind[run.kind == "outbound" and "outbound" or "supply"], run)
end
end
local groups = {}
for _, kind in ipairs({"supply", "outbound"}) do
if #byKind[kind] > 0 then
table.insert(groups, {kind = kind, runs = sortedBy(byKind[kind], "name")})
table.insert(groups, {kind = kind, chain = false, runs = sortedBy(byKind[kind], "name")})
end
end
if #chainRuns > 0 then table.insert(groups, {kind = "supply", chain = true, runs = sortedBy(chainRuns, "name")}) end
return groups
end
-- Navn i listen: kædeflows står under overskriften "Kædernes egne flows", så "Kæde: " fjernes (ellers skjuler
-- afkortningen hvilken bygning det gælder).
function ADFlowView.listName(run)
local name = tostring(run.name or "")
if run.chain ~= nil and run.chain ~= "" then
name = name:gsub("^Kæde:%s*", ""):gsub("^Chain:%s*", "")
end
return name
end
-- Samme rækkefølge som tavlen, som én liste (flow-vælgeren).
function ADFlowView.orderedRuns(runs)
local result = {}