feat(flow-guide): traktorer der ikke kan bruges i flowet vises med navn og grund (før kun et antal); fejl ved opbygning af traktorlisten logges i stedet for at skjule traktoren (v1.36.2.0)

This commit is contained in:
2026-09-27 12:33:45 +02:00
parent d7f4d0b3d3
commit 37768c1507
4 changed files with 19 additions and 3 deletions
+8 -1
View File
@@ -307,6 +307,7 @@ local function rowsTractors(guide)
local inRun = chosenSet(draft.vehicleIds)
local entries = {}
local other, blocked = 0, 0
local blockedTexts = {}
for _, vehicle in ipairs(guide.context.vehicles or {}) do
local state = "free"
if inRun[vehicle.id] then
@@ -317,6 +318,7 @@ local function rowsTractors(guide)
elseif vehicle.blocked then
state = "blocked"
blocked = blocked + 1
table.insert(blockedTexts, tostring(vehicle.text))
end
table.insert(entries, {id = vehicle.id, label = tostring(vehicle.text), state = state})
end
@@ -325,7 +327,12 @@ local function rowsTractors(guide)
end
if #rows == 0 then table.insert(rows, text("spu_guide_flow_noTractors")) end
if other > 0 then table.insert(rows, text("spu_guide_flow_otherFlows", {other})) end
if blocked > 0 then table.insert(rows, text("spu_guide_flow_blocked", {blocked})) end
if blocked > 0 then
table.insert(rows, text("spu_guide_flow_blocked", {blocked}))
-- navn + grund (fx "X ingen vogn"), så man kan se hvorfor en traktor ikke kan vælges
table.sort(blockedTexts)
for _, line in ipairs(blockedTexts) do table.insert(rows, {type = "text", label = T(" " .. line)}) end
end
return rows
end