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
@@ -117,7 +117,12 @@ function SmartPickupFrame:flowVehicleContext(adEnv, preview)
return {id = ADRunsController.getVehicleId(vehicle), text = text, label = ADRunsController.getVehicleLabel(adEnv, vehicle), otherRunId = other ~= nil and other.id or nil,
otherRunName = other ~= nil and other.name or nil, blocked = SmartPickupFrame.VEHICLE_BLOCKING_REASONS[validation.reason] == true}
end)
if ok and entry.id ~= nil then table.insert(result, entry) end
if ok and entry.id ~= nil then
table.insert(result, entry)
elseif not ok then
Logging.warning(SmartPickupFrame.LOG_PREFIX .. "traktor '%s' kunne ikke vises i flowets traktorliste: %s",
tostring(vehicle.getName ~= nil and vehicle:getName() or "?"), tostring(entry))
end
end
return result
end
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<modDesc descVersion="107">
<author>masterdraco</author>
<version>1.36.1.0</version>
<version>1.36.2.0</version>
<title>
<en>AD Smart Pickup</en>
</title>